diff options
author | Yifan Hong <elsk@google.com> | 2020-02-19 15:22:47 -0800 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2020-03-05 16:41:12 +0000 |
commit | 9096550b0c9469caac0b5c204b1f223ffebded0d (patch) | |
tree | 558fe4709f758756fba1a633ced3e1791465c610 /update_status_utils.cc | |
parent | dad0af8905bea862e963a5d5f8eda9b98eecc637 (diff) |
UpdateAttempterAndroid::Init initiates merge
On update_engine starts, schedule CleanupPreviousUpdateAction that calls
CleanupSuccessfulUpdate to do necessary cleanup as soon as possible.
In the good case, update_engine initiates merge when
sys.boot_completed, and clean up snapshots.
If the update is
rolled back or partitions are flashed, the following happens (on
a Virtual A/B device):
- UpdateAttempterAndroid::CleanupSuccessfulUpdate is called
- DynamicPartitionControlAndroid::CleanupSuccessfulUpdate is called
- SnapshotManager::InitiateMergeAndWait is called
- SnapshotManager::RemoveAllUpdateState(before_cancel) is called
- before_cancel is called,
DeltaPerformer::ResetUpdateProgress is called
- All update states in update_engine is reset.
- SnapshotManager proceeds to delete snapshots
- All update states in SnapshotManager is reset.
Hence, on an VAB device, when an update is rolled back or partitions
are flashed, the whole update needs to be re-applied
(while in A/B, it skips writing and directly start verifying hashes of
the target partitions because the update markers are still there).
Bug: 147696014
Test: apply OTA then reboot, inspect logs and do `snapshotctl dump`
Change-Id: I0fc5e7768dfb53e4fd474f2d8d85d2a1b615a88b
Diffstat (limited to 'update_status_utils.cc')
-rw-r--r-- | update_status_utils.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/update_status_utils.cc b/update_status_utils.cc index cbc4f14b..11fd2995 100644 --- a/update_status_utils.cc +++ b/update_status_utils.cc @@ -46,6 +46,8 @@ const char* UpdateStatusToString(const UpdateStatus& status) { return update_engine::kUpdateStatusAttemptingRollback; case UpdateStatus::DISABLED: return update_engine::kUpdateStatusDisabled; + case UpdateStatus::CLEANUP_PREVIOUS_UPDATE: + return update_engine::kUpdateStatusCleanupPreviousUpdate; } NOTREACHED(); @@ -86,6 +88,9 @@ bool StringToUpdateStatus(const std::string& s, UpdateStatus* status) { } else if (s == update_engine::kUpdateStatusDisabled) { *status = UpdateStatus::DISABLED; return true; + } else if (s == update_engine::kUpdateStatusCleanupPreviousUpdate) { + *status = UpdateStatus::CLEANUP_PREVIOUS_UPDATE; + return true; } return false; } |