Improve the logic for mapping target dynamic partitions.

While applying a retrofit update on a dynamic-partitions-enabled build,
it should always use static target partitions. Otherwise reading them
from the updated partition metadata would end up using mismatching info.

This CL improves the logic in detecting and handling such a case.
- It identifies a retrofit or regular update based on the absence of
  DynamicPartitionMetadata field.
- Upon seeing that, it skips updating partition metadata for the target
  slot, and looks up target partitions as static partitions.
- Source partitions will always be loaded according to the actual state.

This CL also removes the re-mapping of the target partitions from
InitPartitionMetadata(). It only needs to unmap those partitions, since
they may become inconsistent with the updated metadata. However, it's
unnecessary to re-map them, which will be done later as part of
GetDynamicPartitionDevice().

Also updated tests to reflect this.

Bug: 120775936
Test: update_engine_unittests
Test: Apply an update with dynamic partitions; abort and resume.
Test: Apply a retrofit update; abort and resume the update.
Change-Id: Ic07bd98847e91a003101266e426c4d23666810f2
diff --git a/payload_consumer/install_plan.cc b/payload_consumer/install_plan.cc
index 5f2697b..1fa27ab 100644
--- a/payload_consumer/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -100,7 +100,8 @@
   for (Partition& partition : partitions) {
     if (source_slot != BootControlInterface::kInvalidSlot) {
       result = boot_control->GetPartitionDevice(
-          partition.name, source_slot, &partition.source_path) && result;
+                   partition.name, source_slot, &partition.source_path) &&
+               result;
     } else {
       partition.source_path.clear();
     }
@@ -108,7 +109,8 @@
     if (target_slot != BootControlInterface::kInvalidSlot &&
         partition.target_size > 0) {
       result = boot_control->GetPartitionDevice(
-          partition.name, target_slot, &partition.target_path) && result;
+                   partition.name, target_slot, &partition.target_path) &&
+               result;
     } else {
       partition.target_path.clear();
     }