[REFACTOR] Pass DeltaArchiveManifest to DynamicPartitionControl
DynamicPartitionControl need the list of operations to calculate
COW sizes.
- Remove BootControlInterface::PartitionMetadata. Replace all references
with DeltaArchiveManifest. DeltaArchiveManifest has all information
that PartitionMetadata has.
- Rename all InitPartitionMetadata to PreparePartitionsForUpdate
- Change all PreparePartitionsForUpdate to use new signature
Bug: 138816109
Test: update_enigne_unittests --gtest_filter=*BootControl*:*Dynamic*
Change-Id: I4389ba2b1801addf8c3bc8395e2ea6a9a3ed27a0
diff --git a/boot_control_android_unittest.cc b/boot_control_android_unittest.cc
index 3b92191..f090de2 100644
--- a/boot_control_android_unittest.cc
+++ b/boot_control_android_unittest.cc
@@ -102,7 +102,7 @@
LoadMetadataBuilder(GetSuperDevice(slot), slot))
.Times(AnyNumber())
.WillRepeatedly(Invoke([sizes](auto, auto) {
- return NewFakeMetadata(PartitionSuffixSizesToMetadata(sizes));
+ return NewFakeMetadata(PartitionSuffixSizesToManifest(sizes));
}));
}
@@ -125,11 +125,11 @@
}));
}
- bool InitPartitionMetadata(uint32_t slot,
- PartitionSizes partition_sizes,
- bool update_metadata = true) {
- auto m = PartitionSizesToMetadata(partition_sizes);
- return bootctl_.InitPartitionMetadata(slot, m, update_metadata);
+ bool PreparePartitionsForUpdate(uint32_t slot,
+ PartitionSizes partition_sizes,
+ bool update_metadata = true) {
+ auto m = PartitionSizesToManifest(partition_sizes);
+ return bootctl_.PreparePartitionsForUpdate(slot, m, update_metadata);
}
BootControlAndroid bootctl_; // BootControlAndroid under test.
@@ -155,9 +155,9 @@
{T("system"), 2_GiB},
{T("vendor"), 1_GiB}});
- // Not calling through BootControlAndroidTest::InitPartitionMetadata(), since
- // we don't want any default group in the PartitionMetadata.
- EXPECT_TRUE(bootctl_.InitPartitionMetadata(target(), {}, true));
+ // Not calling through BootControlAndroidTest::PreparePartitionsForUpdate(),
+ // since we don't want any default group in the PartitionMetadata.
+ EXPECT_TRUE(bootctl_.PreparePartitionsForUpdate(target(), {}, true));
// Should use dynamic source partitions.
EXPECT_CALL(dynamicControl(), GetState(S("system")))
@@ -197,7 +197,7 @@
{T("system"), 2_GiB},
{T("vendor"), 1_GiB}});
- EXPECT_TRUE(InitPartitionMetadata(
+ EXPECT_TRUE(PreparePartitionsForUpdate(
target(), {{"system", 2_GiB}, {"vendor", 1_GiB}}, false));
// Dynamic partition "system".
@@ -240,7 +240,7 @@
TEST_F(BootControlAndroidTest, ApplyingToCurrentSlot) {
SetSlots({1, 1});
- EXPECT_FALSE(InitPartitionMetadata(target(), {}))
+ EXPECT_FALSE(PreparePartitionsForUpdate(target(), {}))
<< "Should not be able to apply to current slot.";
}