Additionally look for partition files under RADIO/ in target_files zip.

With this change, we will in turn look for partition image files under
IMAGES/ and RADIO/ in a given Android/Brillo target_files zip file.

We used to request the caller (e.g. ota_from_target_files.py) to have
all the updatable images ready under IMAGES/, by possibly copying some
of them from RADIO/ to IMAGES/. This CL avoids that cost, and keeps
working with legacy target_files zip files.

Bug: 77218220
Test: `m dist` produces the same full OTA package with the matching
      change to ota_from_target_files.py.
Test: It keeps working with legacy target_files zip that has everything
      under IMAGES/.
Change-Id: I9485508991115774ddbe70c1c235adf6806d91a4
diff --git a/scripts/brillo_update_payload b/scripts/brillo_update_payload
index 61ecadf..0ae4e88 100755
--- a/scripts/brillo_update_payload
+++ b/scripts/brillo_update_payload
@@ -450,7 +450,18 @@
   for part in "${partitions[@]}"; do
     part_file=$(create_tempfile "${part}.img.XXXXXX")
     CLEANUP_FILES+=("${part_file}")
-    unzip -p "${image}" "IMAGES/${part}.img" >"${part_file}"
+
+    # For each partition, we in turn look for its image file under IMAGES/ and
+    # RADIO/ in the given target_files zip file.
+    local path path_in_zip
+    for path in IMAGES RADIO; do
+      if unzip -l "${image}" "${path}/${part}.img" >/dev/null; then
+        path_in_zip="${path}"
+        break
+      fi
+    done
+    [[ -n "${path_in_zip}" ]] || die "Failed to find ${part}.img"
+    unzip -p "${image}" "${path_in_zip}/${part}.img" >"${part_file}"
 
     # If the partition is stored as an Android sparse image file, we need to
     # convert them to a raw image for the update.
@@ -469,7 +480,7 @@
     # Extract the .map file (if one is available).
     part_map_file=$(create_tempfile "${part}.map.XXXXXX")
     CLEANUP_FILES+=("${part_map_file}")
-    unzip -p "${image}" "IMAGES/${part}.map" >"${part_map_file}" || \
+    unzip -p "${image}" "${path_in_zip}/${part}.map" >"${part_map_file}" || \
       part_map_file=""
 
     # delta_generator only supports images multiple of 4 KiB. For target images