DeltaPerformer: Don't destroy previously allocated space
After allocateSpaceForPayload() is called, applyPayload() with
the same hash should not destroy the allocated files then re-allocate.
Fix it so that DeltaPerformer::ResetUpdateProgress skip resetting
the hash in this case.
Bug: 138808058
Test: update_engine_client --allocate, then --apply
Change-Id: Ibc2a7449a6953a707d1c4f23ee11d572f498457c
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index bb7c98c..d8e58b4 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -1959,7 +1959,10 @@
return true;
}
-bool DeltaPerformer::ResetUpdateProgress(PrefsInterface* prefs, bool quick) {
+bool DeltaPerformer::ResetUpdateProgress(
+ PrefsInterface* prefs,
+ bool quick,
+ bool skip_dynamic_partititon_metadata_updated) {
TEST_AND_RETURN_FALSE(prefs->SetInt64(kPrefsUpdateStateNextOperation,
kUpdateStateOperationInvalid));
if (!quick) {
@@ -1973,7 +1976,11 @@
prefs->SetInt64(kPrefsResumedUpdateFailures, 0);
prefs->Delete(kPrefsPostInstallSucceeded);
prefs->Delete(kPrefsVerityWritten);
- prefs->Delete(kPrefsDynamicPartitionMetadataUpdated);
+
+ if (!skip_dynamic_partititon_metadata_updated) {
+ LOG(INFO) << "Resetting recorded hash for prepared partitions.";
+ prefs->Delete(kPrefsDynamicPartitionMetadataUpdated);
+ }
}
return true;
}