Merge "Invoke updateSharedUserPermsLPw for all users when a package is removed." into qt-qpr1-dev

This commit is contained in:
Nicholas Sauer
2019-09-04 15:13:50 +00:00
committed by Android (Google) Code Review

View File

@@ -18890,19 +18890,20 @@ public class PackageManagerService extends IPackageManager.Stub
// or packages running under the shared user of the removed // or packages running under the shared user of the removed
// package if revoking the permissions requested only by the removed // package if revoking the permissions requested only by the removed
// package is successful and this causes a change in gids. // package is successful and this causes a change in gids.
boolean shouldKill = false;
for (int userId : UserManagerService.getInstance().getUserIds()) { for (int userId : UserManagerService.getInstance().getUserIds()) {
final int userIdToKill = mSettings.updateSharedUserPermsLPw(deletedPs, final int userIdToKill = mSettings.updateSharedUserPermsLPw(deletedPs,
userId); userId);
if (userIdToKill == UserHandle.USER_ALL shouldKill |= userIdToKill == UserHandle.USER_ALL
|| userIdToKill >= UserHandle.USER_SYSTEM) { || userIdToKill >= UserHandle.USER_SYSTEM;
// If gids changed for this user, kill all affected packages. }
mHandler.post(() -> { // If gids changed, kill all affected packages.
// This has to happen with no lock held. if (shouldKill) {
killApplication(deletedPs.name, deletedPs.appId, mHandler.post(() -> {
KILL_APP_REASON_GIDS_CHANGED); // This has to happen with no lock held.
}); killApplication(deletedPs.name, deletedPs.appId,
break; KILL_APP_REASON_GIDS_CHANGED);
} });
} }
} }
clearPackagePreferredActivitiesLPw( clearPackagePreferredActivitiesLPw(