Reset the update progress when partition verification fails.
am: 5990bf33b5
Change-Id: I6aec77e1a2d50ec472c8e02135813cc5f692a8fa
diff --git a/update_attempter_android.cc b/update_attempter_android.cc
index 7314a1d..01eb320 100644
--- a/update_attempter_android.cc
+++ b/update_attempter_android.cc
@@ -260,14 +260,31 @@
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.";
- }
+ 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;
+
+ default:
+ // Ignore all other error codes.
+ break;
+ }
TerminateUpdateAndNotify(code);
}