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

Commit 3438bc1b authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Correctly rollback failed system app installs." into lmp-dev

parents eae1c3d5 914bd793
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -9990,6 +9990,7 @@ public class PackageManagerService extends IPackageManager.Stub {
            String installerPackageName, PackageInstalledInfo res) {
        if (DEBUG_INSTALL) Slog.d(TAG, "replaceSystemPackageLI: new=" + pkg
                + ", old=" + deletedPackage);
        boolean disabledSystem = false;
        boolean updatedSettings = false;
        parseFlags |= PackageParser.PARSE_IS_SYSTEM;
        if ((deletedPackage.applicationInfo.flags&ApplicationInfo.FLAG_PRIVILEGED) != 0) {
@@ -10023,7 +10024,8 @@ public class PackageManagerService extends IPackageManager.Stub {
        removePackageLI(oldPkgSetting, true);
        // writer
        synchronized (mPackages) {
            if (!mSettings.disableSystemPackageLPw(packageName) && deletedPackage != null) {
            disabledSystem = mSettings.disableSystemPackageLPw(packageName);
            if (!disabledSystem && deletedPackage != null) {
                // We didn't need to disable the .apk as a current system package,
                // which means we are replacing another update that is already
                // installed.  We need to make sure to delete the older one's .apk.
@@ -10083,8 +10085,10 @@ public class PackageManagerService extends IPackageManager.Stub {
            }
            // Restore the old system information in Settings
            synchronized (mPackages) {
                if (updatedSettings) {
                if (disabledSystem) {
                    mSettings.enableSystemPackageLPw(packageName);
                }
                if (updatedSettings) {
                    mSettings.setInstallerPackageName(packageName,
                            oldPkgSetting.installerPackageName);
                }