diff options
author | Yifan Hong <elsk@google.com> | 2018-11-09 16:50:51 -0800 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2018-11-15 19:01:41 +0000 |
commit | 6e706b165a15e77488ef0009d76680c2f280477f (patch) | |
tree | 005297298da418c19011421c2413aabfd8ec86b7 /boot_control_android_unittest.cc | |
parent | 9edcd045830a9fc7ac22622759b8378929cb7c66 (diff) |
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
Diffstat (limited to 'boot_control_android_unittest.cc')
-rw-r--r-- | boot_control_android_unittest.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/boot_control_android_unittest.cc b/boot_control_android_unittest.cc index e98d2f4b..6460ffec 100644 --- a/boot_control_android_unittest.cc +++ b/boot_control_android_unittest.cc @@ -298,10 +298,12 @@ class BootControlAndroidTest : public ::testing::Test { } void SetMetadata(uint32_t slot, const PartitionMetadata& metadata) { - EXPECT_CALL(dynamicControl(), LoadMetadataBuilder(GetSuperDevice(), slot)) + EXPECT_CALL(dynamicControl(), + LoadMetadataBuilder(GetSuperDevice(), slot, _)) .Times(AnyNumber()) - .WillRepeatedly(Invoke( - [metadata](auto, auto) { return NewFakeMetadata(metadata); })); + .WillRepeatedly(Invoke([metadata](auto, auto, auto) { + return NewFakeMetadata(metadata); + })); } // Expect that MapPartitionOnDeviceMapper is called on target() metadata slot @@ -394,7 +396,7 @@ class BootControlAndroidTest : public ::testing::Test { .Times(0); // Should not load metadata from target slot. EXPECT_CALL(dynamicControl(), - LoadMetadataBuilder(GetSuperDevice(), target())) + LoadMetadataBuilder(GetSuperDevice(), target(), _)) .Times(0); } @@ -512,8 +514,9 @@ TEST_P(BootControlAndroidTestP, DeleteAll) { // Test corrupt source metadata case. TEST_P(BootControlAndroidTestP, CorruptedSourceMetadata) { - EXPECT_CALL(dynamicControl(), LoadMetadataBuilder(GetSuperDevice(), source())) - .WillOnce(Invoke([](auto, auto) { return nullptr; })); + EXPECT_CALL(dynamicControl(), + LoadMetadataBuilder(GetSuperDevice(), source(), _)) + .WillOnce(Invoke([](auto, auto, auto) { return nullptr; })); EXPECT_FALSE(InitPartitionMetadata(target(), {{"system", 1_GiB}})) << "Should not be able to continue with corrupt source metadata"; } |