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

Commit 1b8fc341 authored by JW Wang's avatar JW Wang
Browse files

Move #checkNonOverlappingWithStagedSessions into pre-reboot verification (2/n)

The change breaks CTS. We will fix it in ag/12612516.

Bug: 168268518
Test: atest StagedInstallTest
Change-Id: I7d526488f09b350ed7753e1995d429174d64d658
parent 863fe452
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -1600,13 +1600,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                        validateApkInstallLocked();
                    }
                }
            }

            if (params.isStaged) {
                mStagingManager.checkNonOverlappingWithStagedSessions(this);
            }

            synchronized (mLock) {
                if (mDestroyed) {
                    throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
                            "Session destroyed");
+17 −4
Original line number Diff line number Diff line
@@ -857,7 +857,7 @@ public class StagingManager {
     * </ul>
     * @throws PackageManagerException if session fails the check
     */
    void checkNonOverlappingWithStagedSessions(@NonNull PackageInstallerSession session)
    private void checkNonOverlappingWithStagedSessions(@NonNull PackageInstallerSession session)
            throws PackageManagerException {
        if (session.isMultiPackage()) {
            // We cannot say a parent session overlaps until we process its children
@@ -866,7 +866,7 @@ public class StagingManager {

        String packageName = session.getPackageName();
        if (packageName == null) {
            throw new PackageManagerException(PackageManager.INSTALL_FAILED_INVALID_APK,
            throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
                    "Cannot stage session " + session.sessionId + " with package name null");
        }

@@ -911,7 +911,7 @@ public class StagingManager {
                                + "blocking rollback session: " + session.sessionId);
                    } else {
                        throw new PackageManagerException(
                                PackageManager.INSTALL_FAILED_OTHER_STAGED_SESSION_IN_PROGRESS,
                                SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
                                "Package: " + session.getPackageName() + " in session: "
                                        + session.sessionId + " has been staged already by session:"
                                        + " " + stagedSession.sessionId, null);
@@ -923,7 +923,7 @@ public class StagingManager {
                // from two different root sessions.
                if (!supportsCheckpoint) {
                    throw new PackageManagerException(
                            PackageManager.INSTALL_FAILED_OTHER_STAGED_SESSION_IN_PROGRESS,
                            SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
                            "Cannot stage multiple sessions without checkpoint support", null);
                }
            }
@@ -1266,6 +1266,19 @@ public class StagingManager {
         * See {@link PreRebootVerificationHandler} to see all nodes of pre reboot verification
         */
        private void handlePreRebootVerification_Start(@NonNull PackageInstallerSession session) {
            try {
                if (session.isMultiPackage()) {
                    for (PackageInstallerSession s : session.getChildSessions()) {
                        checkNonOverlappingWithStagedSessions(s);
                    }
                } else {
                    checkNonOverlappingWithStagedSessions(session);
                }
            } catch (PackageManagerException e) {
                onPreRebootVerificationFailure(session, e.error, e.getMessage());
                return;
            }

            int rollbackId = -1;
            if ((session.params.installFlags & PackageManager.INSTALL_ENABLE_ROLLBACK) != 0) {
                // If rollback is enabled for this session, we call through to the RollbackManager