Unconditionally save checkpoints when force = true
When saving update progress, we skiip a checkpoint if operation_num
isn't changed. But sometimes buffer offset changes without changing
operation num, namely, when we extract signature. If a checkpoint is
saved immediately before we extract signature, then we will skip the
checkpoint after signature is extracted, causing the on disk pref to
contain incorrect buffer_offset.
Pref causing resume failure: kPrefsUpdateStateNextDataOffset
Location on disk: /data/misc/update_engine/prefs/update-state-next-data-offset
Test: treehugger, serve an OTA update w/o slot switch then perform slot
switch
Bug: 175785279
Change-Id: Iea2b0b27e1af40e1961a04019e7dd498c02feb13
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index a10815b..5b41485 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -1421,7 +1421,7 @@
return false;
}
Terminator::set_exit_blocked(true);
- if (last_updated_operation_num_ != next_operation_num_) {
+ if (last_updated_operation_num_ != next_operation_num_ || force) {
// Resets the progress in case we die in the middle of the state update.
ResetUpdateProgress(prefs_, true);
TEST_AND_RETURN_FALSE(prefs_->SetString(