code: public static boolean hasRequestedPermission(@NotNull Context context, @NotNull final String permission) {
          boolean hasRequestedPermission = false;
          if (TextUtils.isEmpty(permission)) {
              throw new IllegalArgumentException("Permission can't be null or empty.");
          }
  
          try {
              PackageInfo info = context.getPackageManager()
                      .getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
              if (!CollectionUtils.isEmpty(info.requestedPermissions)) {
                  for (String requestedPermission : info.requestedPermissions) {
                      if (permission.equals(requestedPermission)) {
                          hasRequestedPermission = true;
                          break;
                      }
                  }
              }
          } catch (PackageManager.NameNotFoundException e) {
              Logger.e(e, "Error during checking permission ", permission);
          }
          Logger.d("hasRequestedPermission() is ", hasRequestedPermission, " for ", permission);
          return hasRequestedPermission;
      }
docs: Checks if the AndroidManifest contains a permission.
  
  @param permission The permission to test.
  @return true if the permission is requested by the application.