Fix false negative NeedResize
BootControlAndroid did not call ResizePartitions when the
sizes were all correct to avoid storing metadata more than
once (after resuming from an update), and potentially writing
to incorrect extents. But, when the update starts, the target
metadata slot may contain metadata that happen to exactly
matches the size requirements, but have extents that maps to
currently running devices.
To do this correctly, DeltaPerformer uses PrefsInterface to
avoid calling into InitPartitionMetadata again when it is
initialized.
Hence, BootControlAndroid::InitPartitionMetadata ALWAYS write
metadata to the target slot. Also removed tests to reflect this.
Test: manual OTA
Test: update_engine_unittests
Bug: 117182932
Change-Id: I488ab369e42d582c94974791fdb988d12e695bc2
diff --git a/payload_consumer/delta_performer.h b/payload_consumer/delta_performer.h
index 38d2c43..cddfef4 100644
--- a/payload_consumer/delta_performer.h
+++ b/payload_consumer/delta_performer.h
@@ -271,6 +271,10 @@
// it up.
bool GetPublicKeyFromResponse(base::FilePath *out_tmp_key);
+ // After install_plan_ is filled with partition names and sizes, initialize
+ // metadata of partitions and map necessary devices before opening devices.
+ bool InitPartitionMetadata();
+
// Update Engine preference store.
PrefsInterface* prefs_;