update_engine resize dynamic partitions during OTA.

update_engine uses device mapper to resize dynamic partitions
before opening the devices to apply the update.

* DeltaPerformer calls BootControlInterface::InitPartitionMetadata
  when parsing the update manifest. The implementation for
  BootControlAndroid::InitPartitionMetadata does the following
  if sizes for dynamic partitions are incorrect (assuming updating
  from slot A to B):
  * Load metadata from metadata slot A
  * Delete all extents of partitions at slot B (with _b suffix)
  * Add extents for partitions at slot B
  * Write metadata to metadata slot B
  * Re-map all partitions at slot B using metadata slot B with
    force_writable = true
* BootControlAndroid::GetPartitionDevice() checks device-mapper
  before returning static partitions.
* PostinstallRunnerAction::Cleanup calls BootControlInterface::Cleanup
  which unmaps all partitions at slot B.

A partition "foo" is considered dynamic if foo_a exists as a dynamic
partition OR foo_b does NOT exist as a static partition.

Bug: 110717529

Test: manual ota
Test: update_engine_unittests --gtest_filter=*BootControlAndroid*
Change-Id: I50f410b486a874242663624801c3694151bdda18
diff --git a/Android.mk b/Android.mk
index c49d3c2..062babb 100644
--- a/Android.mk
+++ b/Android.mk
@@ -216,8 +216,10 @@
 
 ue_libupdate_engine_boot_control_exported_shared_libraries := \
     libbootloader_message \
+    libfs_mgr \
     libhwbinder \
     libhidlbase \
+    liblp \
     libutils \
     android.hardware.boot@1.0 \
     $(ue_update_metadata_protos_exported_shared_libraries)
@@ -238,7 +240,8 @@
     $(ue_common_shared_libraries) \
     $(ue_libupdate_engine_boot_control_exported_shared_libraries)
 LOCAL_SRC_FILES := \
-    boot_control_android.cc
+    boot_control_android.cc \
+    dynamic_partition_control_android.cc
 include $(BUILD_STATIC_LIBRARY)
 
 ifeq ($(local_use_omaha),1)
@@ -919,6 +922,7 @@
     $(ue_common_static_libraries) \
     $(ue_libpayload_generator_exported_static_libraries)
 LOCAL_SHARED_LIBRARIES := \
+    libhidltransport \
     $(ue_common_shared_libraries) \
     $(ue_libpayload_generator_exported_shared_libraries)
 LOCAL_SRC_FILES := \
@@ -1029,6 +1033,7 @@
 LOCAL_SHARED_LIBRARIES += \
     $(ue_libupdate_engine_android_exported_shared_libraries)
 LOCAL_SRC_FILES += \
+    boot_control_android_unittest.cc \
     update_attempter_android_unittest.cc
 endif  # local_use_omaha == 1
 include $(BUILD_NATIVE_TEST)