fastbootd: Only flash slots listed by the boot control HAL.
Bug: N/A
Test: flash when metadata slot count is >2
Change-Id: I67481be0de162cab5da8d32c2e318489427f1932
Merged-In: I67481be0de162cab5da8d32c2e318489427f1932
(cherry picked from commit 8568dcb057d63023feca09b031e456592c133f0e)
diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp
index 71d2a1d..e91598d 100644
--- a/fastboot/device/commands.cpp
+++ b/fastboot/device/commands.cpp
@@ -329,12 +329,14 @@
MetadataBuilder* operator->() const { return builder_.get(); }
private:
+ FastbootDevice* device_;
std::string super_device_;
uint32_t slot_number_;
std::unique_ptr<MetadataBuilder> builder_;
};
-PartitionBuilder::PartitionBuilder(FastbootDevice* device, const std::string& partition_name) {
+PartitionBuilder::PartitionBuilder(FastbootDevice* device, const std::string& partition_name)
+ : device_(device) {
std::string slot_suffix = GetSuperSlotSuffix(device, partition_name);
slot_number_ = SlotNumberForSlotSuffix(slot_suffix);
auto super_device = FindPhysicalPartition(fs_mgr_get_super_partition_name(slot_number_));
@@ -350,7 +352,7 @@
if (!metadata) {
return false;
}
- return UpdateAllPartitionMetadata(super_device_, *metadata.get());
+ return UpdateAllPartitionMetadata(device_, super_device_, *metadata.get());
}
bool CreatePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args) {