Remove BootControlInterface::PreparePartitionsForUpdate

Replace with GetDynamicPartitionControl()->PreparePartitionsForUpdate(
GetCurrentSlot(), ...).

Test: update_engine_unittests
Change-Id: Ib03ee97a25727a9292cbb0c9aab5dbe75a2b6913
diff --git a/boot_control_android.cc b/boot_control_android.cc
index 5d11e42..43b2c59 100644
--- a/boot_control_android.cc
+++ b/boot_control_android.cc
@@ -158,16 +158,6 @@
          brillo::MessageLoop::kTaskIdNull;
 }
 
-bool BootControlAndroid::PreparePartitionsForUpdate(
-    Slot target_slot,
-    const DeltaArchiveManifest& manifest,
-    bool update_metadata) {
-
-  auto source_slot = GetCurrentSlot();
-  return dynamic_control_->PreparePartitionsForUpdate(
-      source_slot, target_slot, manifest, update_metadata);
-}
-
 DynamicPartitionControlInterface*
 BootControlAndroid::GetDynamicPartitionControl() {
   return dynamic_control_.get();
diff --git a/boot_control_android.h b/boot_control_android.h
index 0093ecb..5de9fff 100644
--- a/boot_control_android.h
+++ b/boot_control_android.h
@@ -51,9 +51,6 @@
   bool MarkSlotUnbootable(BootControlInterface::Slot slot) override;
   bool SetActiveBootSlot(BootControlInterface::Slot slot) override;
   bool MarkBootSuccessfulAsync(base::Callback<void(bool)> callback) override;
-  bool PreparePartitionsForUpdate(Slot slot,
-                                  const DeltaArchiveManifest& manifest,
-                                  bool update_metadata) override;
   void Cleanup() override;
   DynamicPartitionControlInterface* GetDynamicPartitionControl() override;
 
diff --git a/boot_control_chromeos.cc b/boot_control_chromeos.cc
index 3792e6d..6f50176 100644
--- a/boot_control_chromeos.cc
+++ b/boot_control_chromeos.cc
@@ -329,11 +329,6 @@
   return -1;
 }
 
-bool BootControlChromeOS::PreparePartitionsForUpdate(
-    Slot slot, const DeltaArchiveManifest& manifest, bool update_metadata) {
-  return true;
-}
-
 void BootControlChromeOS::Cleanup() {}
 
 DynamicPartitionControlInterface*
diff --git a/boot_control_chromeos.h b/boot_control_chromeos.h
index 9519fb7..7fe4570 100644
--- a/boot_control_chromeos.h
+++ b/boot_control_chromeos.h
@@ -52,9 +52,6 @@
   bool MarkSlotUnbootable(BootControlInterface::Slot slot) override;
   bool SetActiveBootSlot(BootControlInterface::Slot slot) override;
   bool MarkBootSuccessfulAsync(base::Callback<void(bool)> callback) override;
-  bool PreparePartitionsForUpdate(Slot slot,
-                                  const DeltaArchiveManifest& manifest,
-                                  bool update_metadata) override;
   void Cleanup() override;
   DynamicPartitionControlInterface* GetDynamicPartitionControl() override;
 
diff --git a/common/boot_control_interface.h b/common/boot_control_interface.h
index 2f8e9e3..1242393 100644
--- a/common/boot_control_interface.h
+++ b/common/boot_control_interface.h
@@ -57,9 +57,10 @@
   // The |slot| number must be between 0 and GetNumSlots() - 1 and the
   // |partition_name| is a platform-specific name that identifies a partition on
   // every slot. In order to access the dynamic partitions in the target slot,
-  // PreparePartitionsForUpdate() must be called (once per payload) prior to
-  // calling this function. On success, returns true and stores the block device
-  // in |device|.
+  // GetDynamicPartitionControl()->PreparePartitionsForUpdate() must be called
+  // (with |update| == true for the first time for a payload, and |false| for
+  // for the rest of the times) prior to calling this function. On success,
+  // returns true and stores the block device in |device|.
   virtual bool GetPartitionDevice(const std::string& partition_name,
                                   Slot slot,
                                   std::string* device) const = 0;
@@ -84,14 +85,6 @@
   // of the operation.
   virtual bool MarkBootSuccessfulAsync(base::Callback<void(bool)> callback) = 0;
 
-  // Initializes the metadata of the underlying partitions for a given |slot|
-  // and sets up the states for accessing dynamic partitions.
-  // Metadata will be written to the specified |slot| if
-  // |update_metadata| is set.
-  virtual bool PreparePartitionsForUpdate(Slot slot,
-                                          const DeltaArchiveManifest& manifest,
-                                          bool update_metadata) = 0;
-
   // Do necessary clean-up operations after the whole update.
   virtual void Cleanup() = 0;
 
diff --git a/common/boot_control_stub.cc b/common/boot_control_stub.cc
index 6ae88f1..3d2b6d0 100644
--- a/common/boot_control_stub.cc
+++ b/common/boot_control_stub.cc
@@ -63,12 +63,6 @@
   return false;
 }
 
-bool BootControlStub::PreparePartitionsForUpdate(
-    Slot slot, const DeltaArchiveManifest& manifest, bool update_metadata) {
-  LOG(ERROR) << __FUNCTION__ << " should never be called.";
-  return false;
-}
-
 void BootControlStub::Cleanup() {
   LOG(ERROR) << __FUNCTION__ << " should never be called.";
 }
diff --git a/common/boot_control_stub.h b/common/boot_control_stub.h
index 3307813..24e5f05 100644
--- a/common/boot_control_stub.h
+++ b/common/boot_control_stub.h
@@ -47,9 +47,6 @@
   bool MarkSlotUnbootable(BootControlInterface::Slot slot) override;
   bool SetActiveBootSlot(BootControlInterface::Slot slot) override;
   bool MarkBootSuccessfulAsync(base::Callback<void(bool)> callback) override;
-  bool PreparePartitionsForUpdate(Slot slot,
-                                  const DeltaArchiveManifest& manifest,
-                                  bool update_metadata) override;
   void Cleanup() override;
   DynamicPartitionControlInterface* GetDynamicPartitionControl() override;
 
diff --git a/common/fake_boot_control.h b/common/fake_boot_control.h
index 1d6d979..d621aae 100644
--- a/common/fake_boot_control.h
+++ b/common/fake_boot_control.h
@@ -78,12 +78,6 @@
     return true;
   }
 
-  bool PreparePartitionsForUpdate(Slot slot,
-                                  const DeltaArchiveManifest& manifest,
-                                  bool update_metadata) override {
-    return true;
-  }
-
   void Cleanup() override {}
 
   // Setters
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 8b3f61c..f9244a9 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -947,8 +947,11 @@
 bool DeltaPerformer::PreparePartitionsForUpdate() {
   bool metadata_updated = false;
   prefs_->GetBoolean(kPrefsDynamicPartitionMetadataUpdated, &metadata_updated);
-  if (!boot_control_->PreparePartitionsForUpdate(
-          install_plan_->target_slot, manifest_, !metadata_updated)) {
+  if (!boot_control_->GetDynamicPartitionControl()->PreparePartitionsForUpdate(
+          boot_control_->GetCurrentSlot(),
+          install_plan_->target_slot,
+          manifest_,
+          !metadata_updated)) {
     LOG(ERROR) << "Unable to initialize partition metadata for slot "
                << BootControlInterface::SlotName(install_plan_->target_slot);
     return false;