diff options
| author | Oli Lan <olilan@google.com> | 2019-12-02 14:03:55 +0000 |
|---|---|---|
| committer | Oli Lan <olilan@google.com> | 2019-12-13 14:20:45 +0000 |
| commit | c72b0bba8c399c9be16ffab46bbfa814c59eb55a (patch) | |
| tree | 72adc79d455ec38f869892e9ce5edbdc7b370487 /core/java | |
| parent | 0f15f727f85bd2e8136286d7a66bc6cde84ef699 (diff) | |
Add rollback parameters when submitting sessions to apexd.
This adds parameters to tell apexd if a session has rollback enabled,
or if it is a rollback. The rollback id is also included.
Previously in StagingManager, rollback was only enabled after the
session was submitted. This ordering is reversed in this change to
allow the rollback id to be retrieved.
For the 'is a rollback' case, a new InstallReason of INSTALL_REASON_ROLLBACK
is added, and the rollback id can be retrieved from RollbackManager.
This is an alternate approach to ag/9826517.
Bug: 141148175
Test: atest CtsRollbackManagerHostTestCases
Test: atest CtsStagedInstallHostTestCases
Change-Id: I560ee4ed6dd82277892a511909378d5a5a8502ff
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/content/pm/PackageManager.java | 10 | ||||
| -rw-r--r-- | core/java/android/content/rollback/IRollbackManager.aidl | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 6e890ba0d827..94af5416aa8d 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -946,7 +946,8 @@ public abstract class PackageManager { INSTALL_REASON_POLICY, INSTALL_REASON_DEVICE_RESTORE, INSTALL_REASON_DEVICE_SETUP, - INSTALL_REASON_USER + INSTALL_REASON_USER, + INSTALL_REASON_ROLLBACK }) @Retention(RetentionPolicy.SOURCE) public @interface InstallReason {} @@ -977,6 +978,13 @@ public abstract class PackageManager { public static final int INSTALL_REASON_USER = 4; /** + * Code indicating that the package installation was a rollback initiated by RollbackManager. + * + * @hide + */ + public static final int INSTALL_REASON_ROLLBACK = 5; + + /** * @hide */ public static final int INSTALL_UNKNOWN = 0; diff --git a/core/java/android/content/rollback/IRollbackManager.aidl b/core/java/android/content/rollback/IRollbackManager.aidl index 8c2a65faf8ed..cda0e9865054 100644 --- a/core/java/android/content/rollback/IRollbackManager.aidl +++ b/core/java/android/content/rollback/IRollbackManager.aidl @@ -44,9 +44,10 @@ interface IRollbackManager { // Used by the staging manager to notify the RollbackManager that a session is // being staged. In the case of multi-package sessions, the specified sessionId // is that of the parent session. + // Returns the rollback id if rollback was enabled successfully, or -1 if not. // // NOTE: This call is synchronous. - boolean notifyStagedSession(int sessionId); + int notifyStagedSession(int sessionId); // Used by the staging manager to notify the RollbackManager of the apk // session for a staged session. |
