DynamicPartitionControl: Add required_size to Prepare

Add out parameter required_size to PreparePartitionsForUpdate
to indicate the total size required on /userdata in order
to apply the update.

Bug: 138808058
Test: update_engine_unittests

Change-Id: I2768d13671e212fd24a1a22811b50c9738834459
diff --git a/common/dynamic_partition_control_interface.h b/common/dynamic_partition_control_interface.h
index c171fb5..19bb523 100644
--- a/common/dynamic_partition_control_interface.h
+++ b/common/dynamic_partition_control_interface.h
@@ -64,10 +64,15 @@
   // This is needed before calling MapPartitionOnDeviceMapper(), otherwise the
   // device would be mapped in an inconsistent way.
   // If |update| is set, create snapshots and writes super partition metadata.
+  // If |required_size| is not null and call fails due to insufficient space,
+  // |required_size| will be set to total free space required on userdata
+  // partition to apply the update. Otherwise (call succeeds, or fails
+  // due to other errors), |required_size| is set to zero.
   virtual bool PreparePartitionsForUpdate(uint32_t source_slot,
                                           uint32_t target_slot,
                                           const DeltaArchiveManifest& manifest,
-                                          bool update) = 0;
+                                          bool update,
+                                          uint64_t* required_size) = 0;
 
   // After writing to new partitions, before rebooting into the new slot, call
   // this function to indicate writes to new partitions are done.