Fix uninstall with keep_data flag on multi-user
When uninstalling an app on a multi-user device with the keep data
flag, we end up deleting data still. Here's what seems to happen
in PackageManagerService:
executeDeletePackageLIF
if (ps.isAnyInstalled(userIds)...)
clearPackageStateAndReturn = true
if (clearPackageStateAndReturn)
clearPackageStateForUserLIF(...flags)
destroyAppDataLIF // We unconditionally delete data disregarding
// 'flags' containing KEEP_DATA
We now check keep_data flag before calling destroyAppDataLIF
Test: Manual testing
Bug: 144828398
Change-Id: I009bd412b67000e39f189ef049400d7e00f9a892
This commit is contained in:
@@ -18558,9 +18558,10 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
Slog.d(TAG, "Updating package:" + ps.name + " install state for user:"
|
||||
+ nextUserId);
|
||||
}
|
||||
|
||||
destroyAppDataLIF(pkg, nextUserId,
|
||||
FLAG_STORAGE_DE | FLAG_STORAGE_CE | FLAG_STORAGE_EXTERNAL);
|
||||
if ((flags & PackageManager.DELETE_KEEP_DATA) == 0) {
|
||||
destroyAppDataLIF(pkg, nextUserId,
|
||||
FLAG_STORAGE_DE | FLAG_STORAGE_CE | FLAG_STORAGE_EXTERNAL);
|
||||
}
|
||||
clearDefaultBrowserIfNeededForUser(ps.name, nextUserId);
|
||||
removeKeystoreDataIfNeeded(mInjector.getUserManagerInternal(), nextUserId, ps.appId);
|
||||
clearPackagePreferredActivities(ps.name, nextUserId);
|
||||
|
||||
Reference in New Issue
Block a user