Instant app uninstallation fix.

Bug: 217020148
Fixes: 217020148
Test: atest InstantCookieHostTest
Change-Id: I3f6292a4cbe69506265b3e25f6b6fc484bb1e46e
This commit is contained in:
Alex Buynytskyy
2022-02-07 15:59:26 -08:00
parent a0846285f3
commit 3e084b0c43
2 changed files with 7 additions and 3 deletions

View File

@@ -222,8 +222,12 @@ final class DeletePackageHelper {
deleteFlags | PackageManager.DELETE_CHATTY, info, true);
}
if (res && pkg != null) {
final boolean packageInstalledForSomeUsers;
synchronized (mPm.mLock) {
packageInstalledForSomeUsers = mPm.mPackages.get(pkg.getPackageName()) != null;
}
mPm.mInstantAppRegistry.onPackageUninstalled(pkg, uninstalledPs,
info.mRemovedUsers);
info.mRemovedUsers, packageInstalledForSomeUsers);
}
synchronized (mPm.mLock) {
if (res) {

View File

@@ -444,14 +444,14 @@ public class InstantAppRegistry implements Watchable, Snappable {
}
public void onPackageUninstalled(@NonNull AndroidPackage pkg, @NonNull PackageSetting ps,
@NonNull int[] userIds) {
@NonNull int[] userIds, boolean packageInstalledForSomeUsers) {
if (ps == null) {
return;
}
synchronized (mLock) {
for (int userId : userIds) {
if (ps.getInstalled(userId)) {
if (packageInstalledForSomeUsers && ps.getInstalled(userId)) {
continue;
}