Fix resuming updates on DAP launch devices.

On devices that launch with dynamic partitions, the following
sequence may occur:

- update started (assume current_slot = A)
- super partition metadata slot B initialized
- device rebooted
- init maps system_b from extents in metadata slot A
- update is resumed, but system_b has wrong extents now

InitPartitionMetadata is not called when update is resumed, hence
system_b is not unmapped before GetDynamicPartitionDevice is called.

The new logic for GetDynamicPartitionDevice is as follows:

if (slot == current_slot && partition is mapped) {
    return GetDmDevicePathByName
}
return MapPartitionOnDeviceMapper

The new logic for MapPartitionOnDeviceMapper is as follows:

if (not mapped) return CreateLogicalPartition;
if (mapped) {
    if (mapped by update_engine) {
        return GetDmDevicePathByName;
    }
    DestroyLogicalPartition;
    return CreateLogicalPartition;
}

Test: start OTA, see partition metadata initialized, reboot
      and resume OTA
Test: update_engine_unittests

Fixes: 129292271
Change-Id: If0b541e9aa42a7f462c1061c67750cf360e42732
diff --git a/dynamic_partition_control_android.h b/dynamic_partition_control_android.h
index 0ccab4e..1233b64 100644
--- a/dynamic_partition_control_android.h
+++ b/dynamic_partition_control_android.h
@@ -56,6 +56,11 @@
   std::set<std::string> mapped_devices_;
 
   void CleanupInternal(bool wait);
+  bool MapPartitionInternal(const std::string& super_device,
+                            const std::string& target_partition_name,
+                            uint32_t slot,
+                            bool force_writable,
+                            std::string* path);
 
   DISALLOW_COPY_AND_ASSIGN(DynamicPartitionControlAndroid);
 };