Replace redundant error code with a specific one
As discussed on b/163039465#comment3, it's not desirable to have two distinct catch-all error bucket, where the difference is very subtle. Opting to use STAGED_SESSION_CONFLICT which is more specific, but not too specific. We can use this error is any scenarios where a staged session interferes with installation of another staged session and we have to fail one of them, e.g a staged session is blocking a rollback or rollback will be causing API downgrade which will break another staged session (b/163734200). Bug: 163039465 Test: atest atest RollbackManagerHostTest#testRollbackFailsBlockingSessions Test: atest StagedInstallTest Change-Id: Ia05350024093cd537e8ced5ea02af5853620d6ef
This commit is contained in:
@@ -11901,8 +11901,8 @@ package android.content.pm {
|
||||
field public static final android.os.Parcelable.Creator<android.content.pm.PackageInstaller.SessionInfo> CREATOR;
|
||||
field public static final int INVALID_ID = -1; // 0xffffffff
|
||||
field public static final int STAGED_SESSION_ACTIVATION_FAILED = 2; // 0x2
|
||||
field public static final int STAGED_SESSION_CONFLICT = 4; // 0x4
|
||||
field public static final int STAGED_SESSION_NO_ERROR = 0; // 0x0
|
||||
field public static final int STAGED_SESSION_OTHER_ERROR = 4; // 0x4
|
||||
field public static final int STAGED_SESSION_UNKNOWN = 3; // 0x3
|
||||
field public static final int STAGED_SESSION_VERIFICATION_FAILED = 1; // 0x1
|
||||
}
|
||||
|
||||
@@ -2076,7 +2076,7 @@ public class PackageInstaller {
|
||||
STAGED_SESSION_VERIFICATION_FAILED,
|
||||
STAGED_SESSION_ACTIVATION_FAILED,
|
||||
STAGED_SESSION_UNKNOWN,
|
||||
STAGED_SESSION_OTHER_ERROR})
|
||||
STAGED_SESSION_CONFLICT})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface StagedSessionErrorCode{}
|
||||
/**
|
||||
@@ -2103,10 +2103,10 @@ public class PackageInstaller {
|
||||
public static final int STAGED_SESSION_UNKNOWN = 3;
|
||||
|
||||
/**
|
||||
* Constant indicating that a known error occurred while processing this staged session, but
|
||||
* the error could not be matched to other categories.
|
||||
* Constant indicating that the session was in conflict with another staged session and had
|
||||
* to be sacrificed for resolution.
|
||||
*/
|
||||
public static final int STAGED_SESSION_OTHER_ERROR = 4;
|
||||
public static final int STAGED_SESSION_CONFLICT = 4;
|
||||
|
||||
/** {@hide} */
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
||||
|
||||
@@ -11901,8 +11901,8 @@ package android.content.pm {
|
||||
field public static final android.os.Parcelable.Creator<android.content.pm.PackageInstaller.SessionInfo> CREATOR;
|
||||
field public static final int INVALID_ID = -1; // 0xffffffff
|
||||
field public static final int STAGED_SESSION_ACTIVATION_FAILED = 2; // 0x2
|
||||
field public static final int STAGED_SESSION_CONFLICT = 4; // 0x4
|
||||
field public static final int STAGED_SESSION_NO_ERROR = 0; // 0x0
|
||||
field public static final int STAGED_SESSION_OTHER_ERROR = 4; // 0x4
|
||||
field public static final int STAGED_SESSION_UNKNOWN = 3; // 0x3
|
||||
field public static final int STAGED_SESSION_VERIFICATION_FAILED = 1; // 0x1
|
||||
}
|
||||
|
||||
@@ -957,7 +957,7 @@ public class StagingManager {
|
||||
// will be deleted.
|
||||
}
|
||||
root.setStagedSessionFailed(
|
||||
SessionInfo.STAGED_SESSION_OTHER_ERROR,
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user