Merge "Do not enable rollback for apk session if no rollback found for staged session."
This commit is contained in:
@@ -118,6 +118,10 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
|
||||
@GuardedBy("mLock")
|
||||
private final List<Rollback> mRollbacks;
|
||||
|
||||
// Apk sessions from a staged session with no matching rollback.
|
||||
@GuardedBy("mLock")
|
||||
private final IntArray mOrphanedApkSessionIds = new IntArray();
|
||||
|
||||
private final RollbackStore mRollbackStore;
|
||||
|
||||
private final Context mContext;
|
||||
@@ -655,6 +659,11 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
|
||||
// hasn't actually been updated.
|
||||
onPackageReplaced(apexPackageName);
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
mOrphanedApkSessionIds.clear();
|
||||
}
|
||||
|
||||
mPackageHealthObserver.onBootCompletedAsync();
|
||||
});
|
||||
}
|
||||
@@ -865,6 +874,16 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see if this is the apk session for a staged session for which rollback was
|
||||
// cancelled.
|
||||
synchronized (mLock) {
|
||||
if (mOrphanedApkSessionIds.indexOf(parentSession.getSessionId()) != -1) {
|
||||
Slog.w(TAG, "Not enabling rollback for apk as no matching staged session "
|
||||
+ "rollback exists");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
NewRollback newRollback;
|
||||
synchronized (mLock) {
|
||||
// See if we already have a NewRollback that contains this package
|
||||
@@ -1122,6 +1141,13 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rollback == null) {
|
||||
// Did not find rollback matching originalSessionId.
|
||||
Slog.e(TAG, "notifyStagedApkSession did not find rollback for session "
|
||||
+ originalSessionId
|
||||
+ ". Adding orphaned apk session " + apkSessionId);
|
||||
mOrphanedApkSessionIds.add(apkSessionId);
|
||||
}
|
||||
}
|
||||
|
||||
if (rollback != null) {
|
||||
|
||||
Reference in New Issue
Block a user