Don't return early on error (1/n)
Continue the call flow even when #enableRollbackForPackageSession fails so #completeEnableRollback has a chance to delete a rollback when any of the child sessions fails to enable the rollback for the package. Without this CL, the rollback data won't be deleted until next reboot. Since storage cost might be heavy for the rollback data, we want to delete it as soon as possible without waiting for reboot which might happen much later. Bug: 149352598 Test: test RollbackTest StagedRollbackTest Change-Id: I4aeda1f2447e1b12353d2e3866408aab67a637eb
This commit is contained in:
@@ -982,8 +982,6 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
|
||||
if (!session.isMultiPackage()) {
|
||||
if (!enableRollbackForPackageSession(newRollback, session)) {
|
||||
Slog.e(TAG, "Unable to enable rollback for session: " + sessionId);
|
||||
result.offer(-1);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
for (int childSessionId : session.getChildSessionIds()) {
|
||||
@@ -991,13 +989,11 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
|
||||
installer.getSessionInfo(childSessionId);
|
||||
if (childSession == null) {
|
||||
Slog.e(TAG, "No matching child install session for: " + childSessionId);
|
||||
result.offer(-1);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (!enableRollbackForPackageSession(newRollback, childSession)) {
|
||||
Slog.e(TAG, "Unable to enable rollback for session: " + sessionId);
|
||||
result.offer(-1);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1188,8 +1184,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a rollback to the list of rollbacks. This should be called after rollback has been
|
||||
* enabled for all packages in the rollback. It does not make the rollback available yet.
|
||||
* Add a rollback to the list of rollbacks. It does not make the rollback available yet.
|
||||
*
|
||||
* @return the Rollback instance for a successfully enable-completed rollback,
|
||||
* or null on error.
|
||||
|
||||
Reference in New Issue
Block a user