DynamicPartitionControl: only create snapshot when snapshot_enabled

Do not create snapshot when applying downgrade
to non-Virtual-A/B packages and secondary OTAs.

Test: apply downgrade OTA on Virtual A/B devices

Bug: 138733621 (secondary OTA)
Fixes: 138258570 (downgrades)

Change-Id: I13318f57613d6bd60a5b7e81ebb3e35b3c225a0c
diff --git a/dynamic_partition_control_interface.h b/dynamic_partition_control_interface.h
index 0ccfcd6..9c4c2e8 100644
--- a/dynamic_partition_control_interface.h
+++ b/dynamic_partition_control_interface.h
@@ -92,10 +92,11 @@
   // Prepare all partitions for an update specified in |manifest|.
   // This is needed before calling MapPartitionOnDeviceMapper(), otherwise the
   // device would be mapped in an inconsistent way.
-  virtual bool PreparePartitionsForUpdate(
-      uint32_t source_slot,
-      uint32_t target_slot,
-      const DeltaArchiveManifest& manifest) = 0;
+  // If |update| is set, create snapshots and writes super partition metadata.
+  virtual bool PreparePartitionsForUpdate(uint32_t source_slot,
+                                          uint32_t target_slot,
+                                          const DeltaArchiveManifest& manifest,
+                                          bool update) = 0;
 
   // Return a possible location for devices listed by name.
   virtual bool GetDeviceDir(std::string* path) = 0;