diff options
| author | 2019-02-22 16:24:01 -0800 | |
|---|---|---|
| committer | 2019-03-06 13:04:43 -0800 | |
| commit | d3e6416c0df3d71993c0af0053ab76b8af03cb3b (patch) | |
| tree | f023bbebcaa3526eb06ecfad1f520fef5e3af30a | |
| parent | dddadd76427d11042b0cf8164b5cc794816eeeef (diff) | |
No special case for location permission
The location permissions are not special anymore. In a further change a
new special behavior for the location permission will be added at a
different place.
Test: atest SplitPermissionTest
Change-Id: I770f23804bc1e97b7c1ffa99cecdaf28c8fdf902
| -rw-r--r-- | services/core/java/com/android/server/pm/permission/PermissionManagerService.java | 61 |
1 files changed, 19 insertions, 42 deletions
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java index f927c271ec71..d1a47f6ec588 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java @@ -16,7 +16,6 @@ package com.android.server.pm.permission; -import static android.Manifest.permission.ACCESS_BACKGROUND_LOCATION; import static android.Manifest.permission.READ_EXTERNAL_STORAGE; import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE; import static android.app.AppOpsManager.MODE_ALLOWED; @@ -1364,8 +1363,6 @@ public class PermissionManagerService { @NonNull PermissionsState origPs, @NonNull PermissionsState ps, @NonNull PackageParser.Package pkg, @NonNull int[] updatedUserIds) { - AppOpsManager appOpsManager = mContext.getSystemService(AppOpsManager.class); - String pkgName = pkg.packageName; ArraySet<String> newImplicitPermissions = new ArraySet<>(); @@ -1428,48 +1425,28 @@ public class PermissionManagerService { FLAG_PERMISSION_REVOKE_WHEN_REQUESTED); updatedUserIds = ArrayUtils.appendInt(updatedUserIds, userId); - // SPECIAL BEHAVIOR for background location. Foreground only by default. - if (newPerm.equals(ACCESS_BACKGROUND_LOCATION)) { - int numSourcePerms = sourcePerms.size(); - for (int sourcePermNum = 0; sourcePermNum < numSourcePerms; - sourcePermNum++) { - String sourcePerm = sourcePerms.valueAt(sourcePermNum); - - if (ps.hasRuntimePermission(sourcePerm, userId) - && ps.getRuntimePermissionState(sourcePerm, userId) - .isGranted() - && appOpsManager.unsafeCheckOpNoThrow( - permissionToOp(sourcePerm), getUid(userId, - getAppId(pkg.applicationInfo.uid)), pkgName) - == MODE_ALLOWED) { - setAppOpMode(sourcePerm, pkg, userId, MODE_FOREGROUND); - } - } - } else { - boolean inheritsFromInstallPerm = false; - for (int sourcePermNum = 0; sourcePermNum < sourcePerms.size(); - sourcePermNum++) { - if (ps.hasInstallPermission(sourcePerms.valueAt(sourcePermNum))) { - inheritsFromInstallPerm = true; - break; - } + boolean inheritsFromInstallPerm = false; + for (int sourcePermNum = 0; sourcePermNum < sourcePerms.size(); + sourcePermNum++) { + if (ps.hasInstallPermission(sourcePerms.valueAt(sourcePermNum))) { + inheritsFromInstallPerm = true; + break; } + } - if (!origPs.hasRequestedPermission(sourcePerms) - && !inheritsFromInstallPerm) { - // Both permissions are new so nothing to inherit. - if (DEBUG_PERMISSIONS) { - Slog.i(TAG, newPerm + " does not inherit from " + sourcePerms - + " for " + pkgName - + " as split permission is also new"); - } - - break; - } else { - // Inherit from new install or existing runtime permissions - inheritPermissionStateToNewImplicitPermissionLocked(sourcePerms, - newPerm, ps, pkg, userId); + if (!origPs.hasRequestedPermission(sourcePerms) + && !inheritsFromInstallPerm) { + // Both permissions are new so nothing to inherit. + if (DEBUG_PERMISSIONS) { + Slog.i(TAG, newPerm + " does not inherit from " + sourcePerms + + " for " + pkgName + " as split permission is also new"); } + + break; + } else { + // Inherit from new install or existing runtime permissions + inheritPermissionStateToNewImplicitPermissionLocked(sourcePerms, + newPerm, ps, pkg, userId); } } } |