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

Commit 914bd793 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Correctly rollback failed system app installs.

Fix bug where we disabled system app, but never turned it back on
when the scanPackageLI() failed.

Bug: 17805839
Change-Id: I73999263aee703af187afd980fa0d0ce8451cf0c
parent 3933a5dc
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -9970,6 +9970,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) {
@@ -10003,7 +10004,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.
@@ -10063,8 +10065,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);
                }