Implement PartitionUpdateGenerator for partial updates
Implement the logic in PartitionUpdateGenerator. Here's the summary,
1. finds the a/b partitions (both static & dynamic) on the device
For partitions not included in the payload:
2. calculates the partition hash for filesystem verification
3. generates one SOURCE_COPY operation for each static partition
The order of the partitions are sorted. So the update will resume from
the correct operation in case it's interruptted.
Bug: 157778739
Test: run a partial OTA with boot & system_ext
Change-Id: I5683b85e3c6dab813a33d5144aceb996fd8163d4
diff --git a/dynamic_partition_control_android.h b/dynamic_partition_control_android.h
index e3bedbc..69026a4 100644
--- a/dynamic_partition_control_android.h
+++ b/dynamic_partition_control_android.h
@@ -20,6 +20,7 @@
#include <memory>
#include <set>
#include <string>
+#include <vector>
#include <base/files/file_util.h>
#include <libsnapshot/auto_device.h>
@@ -53,6 +54,11 @@
bool ResetUpdate(PrefsInterface* prefs) override;
+ bool ListDynamicPartitionsForSlot(
+ uint32_t current_slot, std::vector<std::string>* partitions) override;
+
+ bool GetDeviceDir(std::string* path) override;
+
// Return the device for partition |partition_name| at slot |slot|.
// |current_slot| should be set to the current active slot.
// Note: this function is only used by BootControl*::GetPartitionDevice.
@@ -131,9 +137,6 @@
virtual std::unique_ptr<android::fs_mgr::MetadataBuilder> LoadMetadataBuilder(
const std::string& super_device, uint32_t source_slot);
- // Return a possible location for devices listed by name.
- virtual bool GetDeviceDir(std::string* path);
-
// Return the name of the super partition (which stores super partition
// metadata) for a given slot.
virtual std::string GetSuperPartitionName(uint32_t slot);