Add [un]mapPartitions APIs to dynamic partition control

During postinstall stage, update_engine needs all target
partitions(system_b, vendor_b) to be mounted. We add 2 APIs to dynamic
partition control, 1 for mounting all partitions, and UnmapAllPartitions for unmap all partitions.

Test: Treehugger
Bug: 168554689
Change-Id: I1047851f6cdae7f39f50bd1d50e6d3bfc0d9a7f5
diff --git a/common/dynamic_partition_control_interface.h b/common/dynamic_partition_control_interface.h
index 530b0af..c8a2274 100644
--- a/common/dynamic_partition_control_interface.h
+++ b/common/dynamic_partition_control_interface.h
@@ -154,6 +154,11 @@
       const std::string& unsuffixed_partition_name,
       const std::optional<std::string>&,
       bool is_append = false) = 0;
+
+  // Create virtual block devices for all partitions.
+  virtual bool MapAllPartitions() = 0;
+  // Unmap virtual block devices for all partitions.
+  virtual bool UnmapAllPartitions() = 0;
 };
 
 }  // namespace chromeos_update_engine
diff --git a/common/dynamic_partition_control_stub.cc b/common/dynamic_partition_control_stub.cc
index 64ab201..cfc9e2e 100644
--- a/common/dynamic_partition_control_stub.cc
+++ b/common/dynamic_partition_control_stub.cc
@@ -96,4 +96,12 @@
   return nullptr;
 }
 
+bool DynamicPartitionControlStub::MapAllPartitions() {
+  return false;
+}
+
+bool DynamicPartitionControlStub::UnmapAllPartitions() {
+  return false;
+}
+
 }  // namespace chromeos_update_engine
diff --git a/common/dynamic_partition_control_stub.h b/common/dynamic_partition_control_stub.h
index a939cfb..1fc8a35 100644
--- a/common/dynamic_partition_control_stub.h
+++ b/common/dynamic_partition_control_stub.h
@@ -62,6 +62,9 @@
       const std::string& unsuffixed_partition_name,
       const std::optional<std::string>&,
       bool is_append) override;
+
+  bool MapAllPartitions() override;
+  bool UnmapAllPartitions() override;
 };
 }  // namespace chromeos_update_engine