@Ignore @Test public void testHas() { assertThat(Permissions.has(context, INTERNET), is(true)); assertThat(Permissions.has(context, WAKE_LOCK), is(true)); assertThat(Permissions.has(context, WRITE_EXTERNAL_STORAGE), is(false)); }
@CheckResult public static boolean has(@NonNull final Context context, @NonNull final String permission) { return context.checkPermission(permission, Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_GRANTED; }
Permissions { @CheckResult public static boolean has(@NonNull final Context context, @NonNull final String permission) { return context.checkPermission(permission, Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_GRANTED; } }
Permissions { @CheckResult public static boolean has(@NonNull final Context context, @NonNull final String permission) { return context.checkPermission(permission, Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_GRANTED; } private  Permissions(); }
Permissions { @CheckResult public static boolean has(@NonNull final Context context, @NonNull final String permission) { return context.checkPermission(permission, Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_GRANTED; } private  Permissions(); @CheckResult static boolean hasAnyOf(@NonNull final Context context, @NonNull @Size(min = 1) final String... permissions); @CheckResult static boolean hasAllOf(@NonNull final Context context, @NonNull @Size(min = 1) final String... permissions); @CheckResult static boolean has(@NonNull final Context context, @NonNull final String permission); @CheckResult static boolean isSingleGranted(@NonNull final int[] grantResults); }
Permissions { @CheckResult public static boolean has(@NonNull final Context context, @NonNull final String permission) { return context.checkPermission(permission, Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_GRANTED; } private  Permissions(); @CheckResult static boolean hasAnyOf(@NonNull final Context context, @NonNull @Size(min = 1) final String... permissions); @CheckResult static boolean hasAllOf(@NonNull final Context context, @NonNull @Size(min = 1) final String... permissions); @CheckResult static boolean has(@NonNull final Context context, @NonNull final String permission); @CheckResult static boolean isSingleGranted(@NonNull final int[] grantResults);  }