shadows/framework/src/main/java/org/robolectric/shadows/ShadowApplicationPackageManager.java
private int getPermissionIndex(PackageInfo packageInfo, String permissionName) {
    if (packageInfo.requestedPermissions != null) {
      for (int i = 0; i < packageInfo.requestedPermissions.length; i++) {
        if (permissionName.equals(packageInfo.requestedPermissions[i])) {
          return i;
        }
      }
    }

    return -1;
  }
private int getPermissionIndex(PackageInfo packageInfo, String permissionName) {
    if (packageInfo.requestedPermissions != null) {
      for (int i = 0; i < packageInfo.requestedPermissions.length; i++) {
        if (permissionName.equals(packageInfo.requestedPermissions[i])) {
          return i;
        }
      }
    }

    return -1;
  }
private int getPermissionIndex ( PackageInfo packageInfo , String permissionName ) { if ( packageInfo . requestedPermissions != null ) { for ( int i = 0 ; i < packageInfo . requestedPermissions . length ; i ++ ) { if ( permissionName . equals ( packageInfo . requestedPermissions [ i ] ) ) { return i ; } } } return - 1 ; }
Returns the index of the given permission in the PackageInfo.requestedPermissions array, or -1
if it's not found.
Returns the index of the given permission in the PackageInfo . requestedPermissions array or - 1 if it s not found .