diff options
author | Alex Deymo <deymo@google.com> | 2016-07-19 17:01:41 -0700 |
---|---|---|
committer | Alex Deymo <deymo@google.com> | 2016-07-20 08:50:58 -0700 |
commit | 01574ac3e9ed3875133c72fbf0140f06aa344ac7 (patch) | |
tree | 6beb2868a97c0a5a0c9e3b07eab0614fd9729dc0 | |
parent | 3d1ce38dfe5c1da69df02d9a7d69ea90490689d4 (diff) | |
download | update_engine-01574ac3e9ed3875133c72fbf0140f06aa344ac7.tar.gz |
Reset the update progress when partition verification fails.
When the update completes and there is an error verifying the new
partitions we need to reset the update progress proactivelly to
prevent the update failing repeatedly until we hit the 10 retries
limit. This patch will reset the update progress when the payload
application fails to verify the contents of the newly written
partition.
Bug: 30162558
TEST=Push an update, cancel it at 90%, erase some blocks in system,
continue the update (restarts at 90% and then fails), launch the update
again (restarts from 0%).
(cherry picked from commit 5990bf33b50beec0caf55a97f5ca87608ccbc694)
Change-Id: Ie0b22bb190397aa342ca09d55c2b9dfd6ad5f239
-rw-r--r-- | update_attempter_android.cc | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/update_attempter_android.cc b/update_attempter_android.cc index e7f239af..e5173599 100644 --- a/update_attempter_android.cc +++ b/update_attempter_android.cc @@ -260,14 +260,31 @@ void UpdateAttempterAndroid::ProcessingDone(const ActionProcessor* processor, ErrorCode code) { LOG(INFO) << "Processing Done."; - if (code == ErrorCode::kSuccess) { - // Update succeeded. - WriteUpdateCompletedMarker(); - prefs_->SetInt64(kPrefsDeltaUpdateFailures, 0); - DeltaPerformer::ResetUpdateProgress(prefs_, false); + switch (code) { + case ErrorCode::kSuccess: + // Update succeeded. + WriteUpdateCompletedMarker(); + prefs_->SetInt64(kPrefsDeltaUpdateFailures, 0); + DeltaPerformer::ResetUpdateProgress(prefs_, false); + + LOG(INFO) << "Update successfully applied, waiting to reboot."; + break; + + case ErrorCode::kFilesystemCopierError: + case ErrorCode::kNewRootfsVerificationError: + case ErrorCode::kNewKernelVerificationError: + case ErrorCode::kFilesystemVerifierError: + case ErrorCode::kDownloadStateInitializationError: + // Reset the ongoing update for these errors so it starts from the + // beginning next time. + DeltaPerformer::ResetUpdateProgress(prefs_, false); + LOG(INFO) << "Resetting update progress."; + break; - LOG(INFO) << "Update successfully applied, waiting to reboot."; - } + default: + // Ignore all other error codes. + break; + } TerminateUpdateAndNotify(code); } |