SkipInstallOperation placeholders
For some devices, some InstallOperations can be skipped during the
update process. An example is the SOURCE_COPY operation with same
source and destination locations for Virtual A/B devices.
This patch extents the DynamicPartitionControl interface with the
ShouldSkipOperation() method to query if given operation should be
skipped or not.
Bug: 141207436
Test: build
Change-Id: I94dbf1d33d531944e04cb2ffcba274106e866d5d
Signed-off-by: Alessio Balsini <balsini@google.com>
diff --git a/common/dynamic_partition_control_interface.h b/common/dynamic_partition_control_interface.h
index b092f7a..39daf75 100644
--- a/common/dynamic_partition_control_interface.h
+++ b/common/dynamic_partition_control_interface.h
@@ -50,6 +50,9 @@
// Return the feature flags of Virtual A/B on this device.
virtual FeatureFlag GetVirtualAbFeatureFlag() = 0;
+ // Checks if the provided InstallOperation can be skipped on this device.
+ virtual bool ShouldSkipOperation(const InstallOperation& operation) = 0;
+
// Do necessary cleanups before destroying the object.
virtual void Cleanup() = 0;
diff --git a/common/dynamic_partition_control_stub.cc b/common/dynamic_partition_control_stub.cc
index 86f75aa..06f6b3c 100644
--- a/common/dynamic_partition_control_stub.cc
+++ b/common/dynamic_partition_control_stub.cc
@@ -32,6 +32,11 @@
return FeatureFlag(FeatureFlag::Value::NONE);
}
+bool DynamicPartitionControlStub::ShouldSkipOperation(
+ const InstallOperation& operation) {
+ return false;
+}
+
void DynamicPartitionControlStub::Cleanup() {}
bool DynamicPartitionControlStub::PreparePartitionsForUpdate(
diff --git a/common/dynamic_partition_control_stub.h b/common/dynamic_partition_control_stub.h
index e7895de..c62758b 100644
--- a/common/dynamic_partition_control_stub.h
+++ b/common/dynamic_partition_control_stub.h
@@ -29,6 +29,7 @@
public:
FeatureFlag GetDynamicPartitionsFeatureFlag() override;
FeatureFlag GetVirtualAbFeatureFlag() override;
+ bool ShouldSkipOperation(const InstallOperation& operation) override;
void Cleanup() override;
bool PreparePartitionsForUpdate(uint32_t source_slot,
uint32_t target_slot,