summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSen Jiang <senj@google.com>2019-01-02 15:54:40 -0800
committerSen Jiang <senj@google.com>2019-01-02 18:12:28 -0800
commit1bafff885ba760a82b65e25ec1ca544559fdddcb (patch)
treeafa6cbfcd86ca9ca4e810606f3ddf9b7cdc5fea0
parent62b42c896e379c89848f1c6a486e4ec6c51a966d (diff)
Android: Reset update progress when booted into new version.
In Android we don't reset progress after update completes because if automatic update is toggled off after that, we will need to revert the slot switch and still keep the progress. However if we try to apply the same full update again after booted into the new version, it will try to resume and fail on verification because the inactive slot is now the previous version, so we shouldn't resume in this case. Bug: 122117961 Test: progress is reset after booted into new version Change-Id: I394a78fd37bbbdcf62bf85639a9f86e7d3bc42c6
-rw-r--r--update_attempter_android.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/update_attempter_android.cc b/update_attempter_android.cc
index abb45459..a9033b76 100644
--- a/update_attempter_android.cc
+++ b/update_attempter_android.cc
@@ -797,6 +797,11 @@ void UpdateAttempterAndroid::UpdatePrefsAndReportUpdateMetricsOnReboot() {
metrics_utils::LoadAndReportTimeToReboot(
metrics_reporter_.get(), prefs_, clock_.get());
ClearMetricsPrefs();
+
+ // Also reset the update progress if the build version has changed.
+ if (!DeltaPerformer::ResetUpdateProgress(prefs_, false)) {
+ LOG(WARNING) << "Unable to reset the update progress.";
+ }
}
// Save the update start time. Reset the reboot count and attempt number if the