@PermissionResult
    public static int checkCallingOrSelfPermission(@NonNull Context context,
                                                   @NonNull String permission) {
        String packageName = (Binder.getCallingPid() == Process.myPid())
                ? context.getPackageName() : null;
        return checkPermission(context, permission, Binder.getCallingPid(),
                Binder.getCallingUid(), packageName);
    }
Checks whether the IPC you are handling or your app has a given permission
and whether the app op that corresponds to this permission is allowed.

@param context    Context for accessing resources.
@param permission The permission to check.
@return The permission check result which is either {@link #PERMISSION_GRANTED}
or {@link #PERMISSION_DENIED} or {@link #PERMISSION_DENIED_APP_OP}.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/compat/PermissionChecker.java