Have RollbackData reuse RollbackInfo.
Rather than duplicating the same information.
This is in preparation for storing available and recently committed
rollbacks the same way so we don't end up with duplicate copies of
PackageRollbackInfo for a rollback so we can fix the bug when doing
userdata restore for staged installs.
Bug: 124044231
Test: atest RollbackTest
Test: atest StagedRollbackTest
Test: atest AppDataRollbackHelperTest
Change-Id: I6ca164adc4351b778d153d4b33296386f6833b61
diff --git a/core/java/android/content/rollback/RollbackInfo.java b/core/java/android/content/rollback/RollbackInfo.java
index 0cde6ba..9459ad3 100644
--- a/core/java/android/content/rollback/RollbackInfo.java
+++ b/core/java/android/content/rollback/RollbackInfo.java
@@ -17,12 +17,10 @@
package android.content.rollback;
import android.annotation.SystemApi;
-import android.content.pm.PackageInstaller;
import android.content.pm.VersionedPackage;
import android.os.Parcel;
import android.os.Parcelable;
-import java.util.Collections;
import java.util.List;
/**
@@ -44,13 +42,7 @@
private final List<VersionedPackage> mCausePackages;
private final boolean mIsStaged;
- private final int mCommittedSessionId;
-
- /** @hide */
- public RollbackInfo(int rollbackId, List<PackageRollbackInfo> packages, boolean isStaged) {
- this(rollbackId, packages, isStaged, Collections.emptyList(),
- PackageInstaller.SessionInfo.INVALID_ID);
- }
+ private int mCommittedSessionId;
/** @hide */
public RollbackInfo(int rollbackId, List<PackageRollbackInfo> packages, boolean isStaged,
@@ -101,6 +93,14 @@
}
/**
+ * Sets the session ID for the committed rollback for staged rollbacks.
+ * @hide
+ */
+ public void setCommittedSessionId(int sessionId) {
+ mCommittedSessionId = sessionId;
+ }
+
+ /**
* Gets the list of package versions that motivated this rollback.
* As provided to {@link #commitRollback} when the rollback was committed.
* This is only applicable for rollbacks that have been committed.