ShouldSkipOperation -> OptimizeOperation

For SOURCE_COPY operations like
  563412 -> 123456
OptimizeOperation optimizes it to
  5612 -> 1256
and skip writing blocks that does not need to be written for snapshot
partitions.

Bug: 148623880
Test: update_engine_unittests
Test: apply incremental OTA

Change-Id: Ifd2c3851f703f272a74c8f0e9a1c9a82dbcce3e3
diff --git a/common/dynamic_partition_control_interface.h b/common/dynamic_partition_control_interface.h
index 952e8d4..a878f2e 100644
--- a/common/dynamic_partition_control_interface.h
+++ b/common/dynamic_partition_control_interface.h
@@ -56,12 +56,17 @@
   // Return the feature flags of Virtual A/B on this device.
   virtual FeatureFlag GetVirtualAbFeatureFlag() = 0;
 
-  // Checks if |operation| can be skipped on the given partition.
+  // Attempt to optimize |operation|.
+  // If successful, |optimized| contains an operation with extents that
+  // needs to be written.
+  // If failed, no optimization is available, and caller should perform
+  // |operation| directly.
   // |partition_name| should not have the slot suffix; implementation of
   // DynamicPartitionControlInterface checks partition at the target slot
   // previously set with PreparePartitionsForUpdate().
-  virtual bool ShouldSkipOperation(const std::string& partition_name,
-                                   const InstallOperation& operation) = 0;
+  virtual bool OptimizeOperation(const std::string& partition_name,
+                                 const InstallOperation& operation,
+                                 InstallOperation* optimized) = 0;
 
   // Do necessary cleanups before destroying the object.
   virtual void Cleanup() = 0;