Lines Matching defs:permission

31  * This class provides permission check APIs that verify both the
32 * permission and the associated app op for this permission if
35 * In the new permission model permissions with protection level
40 * permission revocations and would crash. Therefore, when the
41 * user disables a permission for a legacy app in the UI the
42 * platform disables the APIs guarded by this permission making
50 * permission model for which the user had disabled the "permission"
55 /** Permission result: The permission is granted. */
58 /** Permission result: The permission is denied. */
61 /** Permission result: The permission is denied because the app op is not allowed. */
75 * Checks whether a given package in a UID and PID has a given permission
76 * and whether the app op that corresponds to this permission is allowed.
79 * @param permission The permission to check.
84 * @return The permission check result which is either {@link #PERMISSION_GRANTED}
87 public static int checkPermission(@NonNull Context context, @NonNull String permission,
89 if (context.checkPermission(permission, pid, uid) == PackageManager.PERMISSION_DENIED) {
93 String op = AppOpsManagerCompat.permissionToOp(permission);
115 * Checks whether your app has a given permission and whether the app op
116 * that corresponds to this permission is allowed.
119 * @param permission The permission to check.
120 * @return The permission check result which is either {@link #PERMISSION_GRANTED}
124 @NonNull String permission) {
125 return checkPermission(context, permission, android.os.Process.myPid(),
130 * Checks whether the IPC you are handling has a given permission and whether
131 * the app op that corresponds to this permission is allowed.
134 * @param permission The permission to check.
137 * @return The permission check result which is either {@link #PERMISSION_GRANTED}
141 @NonNull String permission, String packageName) {
145 return checkPermission(context, permission, Binder.getCallingPid(),
150 * Checks whether the IPC you are handling or your app has a given permission
151 * and whether the app op that corresponds to this permission is allowed.
154 * @param permission The permission to check.
155 * @return The permission check result which is either {@link #PERMISSION_GRANTED}
159 @NonNull String permission) {
162 return checkPermission(context, permission, Binder.getCallingPid(),