Add dynamic_partition_metadata to update manifest

At build time, it will be filled with BOARD_SUPER_PARTITION_GROUPS,
BOARD_*_SIZE, and BOARD_*_PARTITION_LIST.

Only the information from the new target_files package is used. The
META/dynamic_partition_info.txt from old target_files is ignored.

Test: builds and manual OTA
Bug: 117182932
Change-Id: I02ce99caaf7d01cec1470f7262c45490c15dfcb7
diff --git a/scripts/brillo_update_payload b/scripts/brillo_update_payload
index 47ac830..e66edae 100755
--- a/scripts/brillo_update_payload
+++ b/scripts/brillo_update_payload
@@ -258,6 +258,9 @@
 # Path to the postinstall config file in target image if exists.
 POSTINSTALL_CONFIG_FILE=""
 
+# Path to the dynamic partition info file in target image if exists.
+DYNAMIC_PARTITION_INFO_FILE=""
+
 # read_option_int <file.txt> <option_key> [default_value]
 #
 # Reads the unsigned integer value associated with |option_key| in a key=value
@@ -512,6 +515,12 @@
         >"${postinstall_config}"; then
       POSTINSTALL_CONFIG_FILE="${postinstall_config}"
     fi
+    local dynamic_partitions_info=$(create_tempfile "dynamic_partitions_info.XXXXXX")
+    CLEANUP_FILES+=("${dynamic_partitions_info}")
+    if unzip -p "${image}" "META/dynamic_partitions_info.txt" \
+        >"${dynamic_partitions_info}"; then
+      DYNAMIC_PARTITION_INFO_FILE="${dynamic_partitions_info}"
+    fi
   fi
 
   local part
@@ -636,6 +645,12 @@
     )
   fi
 
+  if [[ -n "{DYNAMIC_PARTITION_INFO_FILE}" ]]; then
+    GENERATOR_ARGS+=(
+      --dynamic_partition_info_file="${DYNAMIC_PARTITION_INFO_FILE}"
+    )
+  fi
+
   echo "Running delta_generator with args: ${GENERATOR_ARGS[@]}"
   "${GENERATOR}" "${GENERATOR_ARGS[@]}"