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

Commit 1979201d authored by Oli Lan's avatar Oli Lan Committed by Automerger Merge Worker
Browse files

Merge "Abandon other staged sessions when a rollback is staged." into sc-dev am: 79bbe49b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15132975

Change-Id: I34784cae5655abf289d705ffae656679b48bf4ec
parents ae51aa62 79bbe49b
Loading
Loading
Loading
Loading
+24 −24
Original line number Original line Diff line number Diff line
@@ -737,11 +737,10 @@ public class StagingManager {
                    continue;
                    continue;
                }
                }


                // New session cannot have same package name as one of the active sessions
                if (isRollback && !isRollback(stagedSession)) {
                if (stagedSession.sessionContains(s -> s.getPackageName().equals(packageName))) {
                    if (isRollback) {
                    // If the new session is a rollback, then it gets priority. The existing
                    // If the new session is a rollback, then it gets priority. The existing
                        // session is failed to unblock rollback.
                    // session is failed to reduce risk and avoid an SDK extension dependency
                    // violation.
                    final StagedSession root = stagedSession;
                    final StagedSession root = stagedSession;
                    if (!ensureActiveApexSessionIsAborted(root)) {
                    if (!ensureActiveApexSessionIsAborted(root)) {
                        Slog.e(TAG, "Failed to abort apex session " + root.sessionId());
                        Slog.e(TAG, "Failed to abort apex session " + root.sessionId());
@@ -751,10 +750,12 @@ public class StagingManager {
                    }
                    }
                    root.setSessionFailed(
                    root.setSessionFailed(
                            SessionInfo.STAGED_SESSION_CONFLICT,
                            SessionInfo.STAGED_SESSION_CONFLICT,
                                "Session was blocking rollback session: " + session.sessionId());
                            "Session was failed by rollback session: " + session.sessionId());
                    Slog.i(TAG, "Session " + root.sessionId() + " is marked failed due to "
                    Slog.i(TAG, "Session " + root.sessionId() + " is marked failed due to "
                                + "blocking rollback session: " + session.sessionId());
                            + "rollback session: " + session.sessionId());
                    } else {
                } else if (stagedSession.sessionContains(
                        s -> s.getPackageName().equals(packageName))) {
                    // New session cannot have same package name as one of the active sessions
                    throw new PackageManagerException(
                    throw new PackageManagerException(
                            SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
                            SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
                            "Package: " + session.getPackageName() + " in session: "
                            "Package: " + session.getPackageName() + " in session: "
@@ -762,7 +763,6 @@ public class StagingManager {
                                    + " has been staged already by session: "
                                    + " has been staged already by session: "
                                    + stagedSession.sessionId(), null);
                                    + stagedSession.sessionId(), null);
                }
                }
                }


                // Staging multiple root sessions is not allowed if device doesn't support
                // Staging multiple root sessions is not allowed if device doesn't support
                // checkpoint. If session and stagedSession do not have common ancestor, they are
                // checkpoint. If session and stagedSession do not have common ancestor, they are