Don't list dynamic if a slot doesn't support DAP
If a slot doesn't support dynamic partitions, it's impossible to list
dynamic partitions on that slot. And we should just fall back to the
regular A/B in this case.
Bug: 180025432
Test: apply a retrofit package
Change-Id: I16c457b591e8c1d0cf1077a7be50dd9d8f61b8eb
diff --git a/common/dynamic_partition_control_interface.h b/common/dynamic_partition_control_interface.h
index 8368eeb..61127d4 100644
--- a/common/dynamic_partition_control_interface.h
+++ b/common/dynamic_partition_control_interface.h
@@ -134,11 +134,13 @@
// allocated space for snapshot updates.
virtual bool ResetUpdate(PrefsInterface* prefs) = 0;
- // Reads the dynamic partitions metadata from the current slot, and puts the
+ // Reads the dynamic partitions metadata from the given slot, and puts the
// name of the dynamic partitions with the current suffix to |partitions|.
// Returns true on success.
virtual bool ListDynamicPartitionsForSlot(
- uint32_t current_slot, std::vector<std::string>* partitions) = 0;
+ uint32_t slot,
+ uint32_t current_slot,
+ std::vector<std::string>* partitions) = 0;
// Finds a possible location that list all block devices by name; and puts
// the result in |path|. Returns true on success.
diff --git a/common/dynamic_partition_control_stub.cc b/common/dynamic_partition_control_stub.cc
index b6eff84..7d0ef18 100644
--- a/common/dynamic_partition_control_stub.cc
+++ b/common/dynamic_partition_control_stub.cc
@@ -73,7 +73,9 @@
}
bool DynamicPartitionControlStub::ListDynamicPartitionsForSlot(
- uint32_t current_slot, std::vector<std::string>* partitions) {
+ uint32_t slot,
+ uint32_t current_slot,
+ std::vector<std::string>* partitions) {
return true;
}
diff --git a/common/dynamic_partition_control_stub.h b/common/dynamic_partition_control_stub.h
index 822fa1b..5ab82f5 100644
--- a/common/dynamic_partition_control_stub.h
+++ b/common/dynamic_partition_control_stub.h
@@ -50,7 +50,9 @@
bool ResetUpdate(PrefsInterface* prefs) override;
bool ListDynamicPartitionsForSlot(
- uint32_t current_slot, std::vector<std::string>* partitions) override;
+ uint32_t slot,
+ uint32_t current_slot,
+ std::vector<std::string>* partitions) override;
bool GetDeviceDir(std::string* path) override;
bool VerifyExtentsForUntouchedPartitions(
diff --git a/common/mock_dynamic_partition_control.h b/common/mock_dynamic_partition_control.h
index a00ec61..74f4efc 100644
--- a/common/mock_dynamic_partition_control.h
+++ b/common/mock_dynamic_partition_control.h
@@ -72,8 +72,9 @@
(override));
MOCK_METHOD(bool,
ListDynamicPartitionsForSlot,
- (uint32_t, std::vector<std::string>*),
+ (uint32_t, uint32_t, std::vector<std::string>*),
(override));
+
MOCK_METHOD(bool,
VerifyExtentsForUntouchedPartitions,
(uint32_t, uint32_t, const std::vector<std::string>&),