DynamicPartitionControl: support retrofit devices
On retrofit devices:
* The retrofit update includes block devices at source
slot (for example, system_a, vendor_a, product_a).
This is done automatically because the retrofit update
does not look different from regular updates in OTA
client's perspective.
* The first update after the retrofit update includes
the rest of the block devices (in the above example,
system_b, vendor_b and product_b).
In order to do the second,
* use NewForUpdate() API from liblp to automatically
include block devices at the target slot when the metadata
is loaded.
* Use FlashPartitionTable() API to flash metadata to system_b
directly without reading existing metadata from it.
Test: manual OTA on retrofit devices
Bug: 118506262
Change-Id: Ib2c15b8a1a04271320bfef408813723a5b2a7bd7
diff --git a/mock_dynamic_partition_control.h b/mock_dynamic_partition_control.h
index 6b233b3..7b37581 100644
--- a/mock_dynamic_partition_control.h
+++ b/mock_dynamic_partition_control.h
@@ -38,9 +38,9 @@
MOCK_METHOD1(DeviceExists, bool(const std::string&));
MOCK_METHOD1(GetState, ::android::dm::DmDeviceState(const std::string&));
MOCK_METHOD2(GetDmDevicePathByName, bool(const std::string&, std::string*));
- MOCK_METHOD2(LoadMetadataBuilder,
+ MOCK_METHOD3(LoadMetadataBuilder,
std::unique_ptr<::android::fs_mgr::MetadataBuilder>(
- const std::string&, uint32_t));
+ const std::string&, uint32_t, uint32_t));
MOCK_METHOD3(StoreMetadata,
bool(const std::string&,
android::fs_mgr::MetadataBuilder*,