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

Commit 7cdd118f authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Fix uninstalling launcher detaches system overlays

Bug: 352416406
Test: 1. install launcher, reboot, and uninstall in gesture nav mode.
Make sure that it renders nav bar after downgrade finishes. 2. install
launcher, and uninstall. Same behavior
Flag: EXEMPT bugfix

Change-Id: I5a9e9a8aeef123bed449de976023375f89a994f3
parent 0e3d092e
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -3264,6 +3264,7 @@ final class InstallPackageHelper {
    /**
     * Tries to restore the disabled system package after an update has been deleted.
     */
    @GuardedBy("mPm.mInstallLock")
    public void restoreDisabledSystemPackageLIF(DeletePackageAction action,
            @NonNull int[] allUserHandles, boolean writeSettings) throws SystemDeleteException {
        final PackageSetting deletedPs = action.mDeletingPs;
@@ -3282,10 +3283,21 @@ final class InstallPackageHelper {
        }
        // Install the system package
        if (DEBUG_REMOVE) Slog.d(TAG, "Re-installing system package: " + disabledPs);
        try (PackageManagerTracedLock installLock = mPm.mInstallLock.acquireLock()) {
        try {
            final int[] origUsers = outInfo == null ? null : outInfo.mOrigUsers;
            try (PackageManagerTracedLock installLock = mPm.mInstallLock.acquireLock()) {
                installPackageFromSystemLIF(disabledPs.getPathString(), allUserHandles,
                        origUsers, writeSettings);
            }
            if (origUsers != null) {
                mPm.commitPackageStateMutation(null, mutator -> {
                    for (int userId : origUsers) {
                        mutator.forPackage(disabledPs.getPackageName())
                                .userState(userId)
                                .setOverlayPaths(deletedPs.getOverlayPaths(userId));
                    }
                });
            }
        } catch (PackageManagerException e) {
            Slog.w(TAG, "Failed to restore system package:" + deletedPs.getPackageName() + ": "
                    + e.getMessage());