diff options
author | Tony Mak <tonymak@google.com> | 2015-06-19 17:52:49 +0100 |
---|---|---|
committer | Tony Mak <tonymak@google.com> | 2015-06-19 17:52:49 +0100 |
commit | 8e33f63040db4f8326c1bf678645a42ab79c32f3 (patch) | |
tree | a80485e67894ebd23cca4b9837640a08baed3350 /services | |
parent | 1247e48e0262ea9ac807bbd0e0939dc0450cd6ab (diff) | |
download | frameworks_base-8e33f63040db4f8326c1bf678645a42ab79c32f3.zip frameworks_base-8e33f63040db4f8326c1bf678645a42ab79c32f3.tar.gz frameworks_base-8e33f63040db4f8326c1bf678645a42ab79c32f3.tar.bz2 |
Clear granted permission when app is uninstalled by one of the multiple users
Bug: 21838358
Change-Id: Iccd46382c9468d0503da0bb49a49040ae712e2cc
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 709ae54..e7fddb9 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -12500,6 +12500,8 @@ public class PackageManagerService extends IPackageManager.Stub { if (clearPackagePreferredActivitiesLPw(packageName, removeUser)) { scheduleWritePackageRestrictionsLocked(removeUser); } + revokeRuntimePermissionsAndClearAllFlagsLocked(ps.getPermissionsState(), + removeUser); } return true; } @@ -12706,13 +12708,37 @@ public class PackageManagerService extends IPackageManager.Stub { | PackageManager.FLAG_PERMISSION_USER_FIXED | PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE; + revokeRuntimePermissionsAndClearFlagsLocked(permissionsState, userId, userSetFlags); + } + + /** + * Revokes granted runtime permissions and clears all flags. + * + * @param permissionsState The permission state to reset. + * @param userId The device user for which to do a reset. + */ + private void revokeRuntimePermissionsAndClearAllFlagsLocked( + PermissionsState permissionsState, int userId) { + revokeRuntimePermissionsAndClearFlagsLocked(permissionsState, userId, + PackageManager.MASK_PERMISSION_FLAGS); + } + + /** + * Revokes granted runtime permissions and clears certain flags. + * + * @param permissionsState The permission state to reset. + * @param userId The device user for which to do a reset. + * @param flags The flags that is going to be reset. + */ + private void revokeRuntimePermissionsAndClearFlagsLocked( + PermissionsState permissionsState, int userId, int flags) { boolean needsWrite = false; for (PermissionState state : permissionsState.getRuntimePermissionStates(userId)) { BasePermission bp = mSettings.mPermissions.get(state.getName()); if (bp != null) { permissionsState.revokeRuntimePermission(bp, userId); - permissionsState.updatePermissionFlags(bp, userId, userSetFlags, 0); + permissionsState.updatePermissionFlags(bp, userId, flags, 0); needsWrite = true; } } |