code: private static boolean hasSelfPermissions(Context context, String... permissions) {
      for (String permission : permissions) {
        if (checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED) {
          return true;
        }
      }
      return false;
    }
docs: Returns true if the context has access to any given permissions.