@Test public void permissionsState() { when(mContext.checkCallingOrSelfPermission(anyString())).thenReturn(PackageManager.PERMISSION_GRANTED); String[] strings = new String[]{ Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE }; int[] permissionsState = PermissionUtils.permissionsState(mContext, strings); assertEquals(strings.length, permissionsState.length); verify(mContext, times(strings.length)).checkCallingOrSelfPermission(anyString()); }
public static int[] permissionsState(Context context, String... permissions) { if (permissions == null) { return null; } int[] state = new int[permissions.length]; for (int i = 0; i < permissions.length; i++) { state[i] = context.checkCallingOrSelfPermission(permissions[i]); } return state; }
PermissionUtils { public static int[] permissionsState(Context context, String... permissions) { if (permissions == null) { return null; } int[] state = new int[permissions.length]; for (int i = 0; i < permissions.length; i++) { state[i] = context.checkCallingOrSelfPermission(permissions[i]); } return state; } }
PermissionUtils { public static int[] permissionsState(Context context, String... permissions) { if (permissions == null) { return null; } int[] state = new int[permissions.length]; for (int i = 0; i < permissions.length; i++) { state[i] = context.checkCallingOrSelfPermission(permissions[i]); } return state; }  }
PermissionUtils { public static int[] permissionsState(Context context, String... permissions) { if (permissions == null) { return null; } int[] state = new int[permissions.length]; for (int i = 0; i < permissions.length; i++) { state[i] = context.checkCallingOrSelfPermission(permissions[i]); } return state; }  static int[] permissionsState(Context context, String... permissions); static boolean permissionsAreGranted(int[] permissionsState); }
PermissionUtils { public static int[] permissionsState(Context context, String... permissions) { if (permissions == null) { return null; } int[] state = new int[permissions.length]; for (int i = 0; i < permissions.length; i++) { state[i] = context.checkCallingOrSelfPermission(permissions[i]); } return state; }  static int[] permissionsState(Context context, String... permissions); static boolean permissionsAreGranted(int[] permissionsState);  }