Invoke updateSharedUserPermsLPw for all users when a package is
removed. bug: 140274903 Test: While running under both user 0 and user 10: $ cts-tradefed run cts-dev -m CtsPermissionTestCases --test android.permission.cts.SharedUidPermissionsTest#sharedUidLoosesRuntimePermissionWhenLastAppDeclaringItGetsUninstalled Also: $ adb install out/.../CtsAppWithSharedUidThatRequestsPermissions.apk $ adb install out/.../CtsAppWithSharedUidThatRequestsNoPermissions.apk $ adb shell pm grant android.permission.cts.appthatrequestpermission android.permission.READ_CONTACTS $ adb uninstall android.permission.cts.appthatrequestpermission $ adb shell dumpsys package android.permission.cts.appthatrequestnopermission ... verify that READ_CONTACT permission is removed from appthatrequestnopermission Change-Id: Ibbecc0965ae3fe84e0a51c8fa6b9fcc80b6f9640
This commit is contained in:
@@ -18890,19 +18890,20 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
// or packages running under the shared user of the removed
|
||||
// package if revoking the permissions requested only by the removed
|
||||
// package is successful and this causes a change in gids.
|
||||
boolean shouldKill = false;
|
||||
for (int userId : UserManagerService.getInstance().getUserIds()) {
|
||||
final int userIdToKill = mSettings.updateSharedUserPermsLPw(deletedPs,
|
||||
userId);
|
||||
if (userIdToKill == UserHandle.USER_ALL
|
||||
|| userIdToKill >= UserHandle.USER_SYSTEM) {
|
||||
// If gids changed for this user, kill all affected packages.
|
||||
mHandler.post(() -> {
|
||||
// This has to happen with no lock held.
|
||||
killApplication(deletedPs.name, deletedPs.appId,
|
||||
KILL_APP_REASON_GIDS_CHANGED);
|
||||
});
|
||||
break;
|
||||
}
|
||||
shouldKill |= userIdToKill == UserHandle.USER_ALL
|
||||
|| userIdToKill >= UserHandle.USER_SYSTEM;
|
||||
}
|
||||
// If gids changed, kill all affected packages.
|
||||
if (shouldKill) {
|
||||
mHandler.post(() -> {
|
||||
// This has to happen with no lock held.
|
||||
killApplication(deletedPs.name, deletedPs.appId,
|
||||
KILL_APP_REASON_GIDS_CHANGED);
|
||||
});
|
||||
}
|
||||
}
|
||||
clearPackagePreferredActivitiesLPw(
|
||||
|
||||
Reference in New Issue
Block a user