Merge "fastbootd: Partition commands should update all metadata slots."
diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp
index 6e45133..11c838a 100644
--- a/fastboot/device/commands.cpp
+++ b/fastboot/device/commands.cpp
@@ -329,7 +329,6 @@
private:
std::string super_device_;
- uint32_t slot_number_;
std::unique_ptr<MetadataBuilder> builder_;
};
@@ -341,8 +340,8 @@
super_device_ = *super_device;
std::string slot = device->GetCurrentSlot();
- slot_number_ = SlotNumberForSlotSuffix(slot);
- builder_ = MetadataBuilder::New(super_device_, slot_number_);
+ uint32_t slot_number = SlotNumberForSlotSuffix(slot);
+ builder_ = MetadataBuilder::New(super_device_, slot_number);
}
bool PartitionBuilder::Write() {
@@ -350,7 +349,11 @@
if (!metadata) {
return false;
}
- return UpdatePartitionTable(super_device_, *metadata.get(), slot_number_);
+ bool ok = true;
+ for (uint32_t i = 0; i < metadata->geometry.metadata_slot_count; i++) {
+ ok &= UpdatePartitionTable(super_device_, *metadata.get(), i);
+ }
+ return ok;
}
bool CreatePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args) {