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

Commit ae0c65a7 authored by JW Wang's avatar JW Wang
Browse files

Don't enable rollback again in pre-reboot verification

See b/167645815#comment1 for details.

1. In notifyStagedSession(), rollback is enabled for the 1st time.
2. In verifyStagedSession(), rollback is enabled again and
   FileAlreadyExistsException is thrown.

Remove the INSTALL_ENABLE_ROLLBACK flag if the verification is kicked
off by a staged install.

Bug: 167645815
Test: atest RollbackManagerHostTest#testApkOnlyMultipleStagedPartialRollback
      and check logcat messages that no FileAlreadyExistsException is thrown
Change-Id: Id8a96a1dd790331170e2a7e201634b23d20424c6
parent a44e3df0
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2080,7 +2080,14 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {

        mRelinquished = true;

        return mPm.new VerificationParams(user, stageDir, localObserver, params,
        // TODO(b/169375643): Remove this workaround once b/161121612 is fixed.
        PackageInstaller.SessionParams copiedParams = params.copy();
        if (params.isStaged) {
            // This is called by the pre-reboot verification. Don't enable rollback here since
            // it has been enabled when pre-reboot verification starts.
            copiedParams.installFlags &= ~PackageManager.INSTALL_ENABLE_ROLLBACK;
        }
        return mPm.new VerificationParams(user, stageDir, localObserver, copiedParams,
                mInstallSource, mInstallerUid, mSigningDetails, sessionId);
    }