Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 415dd94a authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Fail fast when trying to delete a non-existing pacakge.

bug:26921392

Change-Id: I518cc43f3b1b28bd239093feead46107c62eb419
parent dafec11e
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -14112,20 +14112,19 @@ public class PackageManagerService extends IPackageManager.Stub {
            return PackageManager.DELETE_FAILED_DEVICE_POLICY_MANAGER;
        }
        PackageParser.Package uninstalledPkg;
        PackageSetting uninstalledPs = null;
        // for the uninstall-updates case and restricted profiles, remember the per-
        // user handle installed state
        int[] allUsers;
        synchronized (mPackages) {
            uninstalledPkg = mPackages.get(packageName);
            PackageSetting ps = mSettings.mPackages.get(packageName);
            if (ps == null || uninstalledPkg == null) {
            uninstalledPs = mSettings.mPackages.get(packageName);
            if (uninstalledPs == null) {
                Slog.w(TAG, "Not removing non-existent package " + packageName);
                return PackageManager.DELETE_FAILED_INTERNAL_ERROR;
            }
            allUsers = sUserManager.getUserIds();
            info.origUsers = ps.queryInstalledUsers(allUsers, true);
            info.origUsers = uninstalledPs.queryInstalledUsers(allUsers, true);
        }
        synchronized (mInstallLock) {
@@ -14134,7 +14133,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                    flags | REMOVE_CHATTY, info, true, null);
            synchronized (mPackages) {
                if (res) {
                    mEphemeralApplicationRegistry.onPackageUninstalledLPw(uninstalledPkg);
                    mEphemeralApplicationRegistry.onPackageUninstalledLPw(uninstalledPs.pkg);
                }
            }
        }