summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Oli Lan <olilan@google.com> 2021-07-01 15:58:03 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-07-01 15:58:03 +0000
commit79bbe49b4bfd10766fbc65ea08e07c86a6a5e76c (patch)
treeb14f1312d74c76779a3ebca9290e69deb7fd260b
parent0c13593a1841357df8851c5078f66ec167896dc0 (diff)
parentc1e8f1f8230debaf9c3d4f5a8671bc74e4d39713 (diff)
Merge "Abandon other staged sessions when a rollback is staged." into sc-dev
-rw-r--r--services/core/java/com/android/server/pm/StagingManager.java48
1 files changed, 24 insertions, 24 deletions
diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java
index c842ff1b11a5..cb78636065aa 100644
--- a/services/core/java/com/android/server/pm/StagingManager.java
+++ b/services/core/java/com/android/server/pm/StagingManager.java
@@ -737,31 +737,31 @@ public class StagingManager {
continue;
}
- // New session cannot have same package name as one of the active sessions
- if (stagedSession.sessionContains(s -> s.getPackageName().equals(packageName))) {
- if (isRollback) {
- // If the new session is a rollback, then it gets priority. The existing
- // session is failed to unblock rollback.
- final StagedSession root = stagedSession;
- if (!ensureActiveApexSessionIsAborted(root)) {
- Slog.e(TAG, "Failed to abort apex session " + root.sessionId());
- // Safe to ignore active apex session abort failure since session
- // will be marked failed on next step and staging directory for session
- // will be deleted.
- }
- root.setSessionFailed(
- SessionInfo.STAGED_SESSION_CONFLICT,
- "Session was blocking rollback session: " + session.sessionId());
- Slog.i(TAG, "Session " + root.sessionId() + " is marked failed due to "
- + "blocking rollback session: " + session.sessionId());
- } else {
- throw new PackageManagerException(
- SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
- "Package: " + session.getPackageName() + " in session: "
- + session.sessionId()
- + " has been staged already by session: "
- + stagedSession.sessionId(), null);
+ if (isRollback && !isRollback(stagedSession)) {
+ // If the new session is a rollback, then it gets priority. The existing
+ // session is failed to reduce risk and avoid an SDK extension dependency
+ // violation.
+ final StagedSession root = stagedSession;
+ if (!ensureActiveApexSessionIsAborted(root)) {
+ Slog.e(TAG, "Failed to abort apex session " + root.sessionId());
+ // Safe to ignore active apex session abort failure since session
+ // will be marked failed on next step and staging directory for session
+ // will be deleted.
}
+ root.setSessionFailed(
+ SessionInfo.STAGED_SESSION_CONFLICT,
+ "Session was failed by rollback session: " + session.sessionId());
+ Slog.i(TAG, "Session " + root.sessionId() + " is marked failed due to "
+ + "rollback session: " + session.sessionId());
+ } 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(
+ SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "Package: " + session.getPackageName() + " in session: "
+ + session.sessionId()
+ + " has been staged already by session: "
+ + stagedSession.sessionId(), null);
}
// Staging multiple root sessions is not allowed if device doesn't support