extract_utils: prefix_match(): do not strip target_args from its output

* The write_product_copy_files() and write_product_packages() functions
  rely on its undocumented behavior of keeping target_args in the
  returned list, because they are users of target_args (such as
  ";PRESIGNED" etc).
* Make the behavior documented.

Change-Id: If71595dca32abd40039706d4fed2d7f12e005365
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
diff --git a/extract_utils.sh b/extract_utils.sh
index 69fabd3..b0c712a 100644
--- a/extract_utils.sh
+++ b/extract_utils.sh
@@ -147,17 +147,23 @@
 #
 # prefix_match:
 #
-# $1: the prefix to match on
-#
-# Internal function which loops thru the packages list and returns a new
-# list containing the matched files with the prefix stripped away.
+# input:
+#   - $1: prefix
+#   - (global variable) PRODUCT_PACKAGES_LIST: array of [src:]dst[;args] specs.
+# output:
+#   - new array consisting of dst[;args] entries where $1 is a prefix of ${dst}.
 #
 function prefix_match() {
     local PREFIX="$1"
     for LINE in "${PRODUCT_PACKAGES_LIST[@]}"; do
         local FILE=$(target_file "$LINE")
         if [[ "$FILE" =~ ^"$PREFIX" ]]; then
-            printf '%s\n' "${FILE#$PREFIX}"
+            local ARGS=$(target_args "$LINE")
+            if [ -z "${ARGS}" ]; then
+                echo "${FILE#$PREFIX}"
+            else
+                echo "${FILE#$PREFIX};${ARGS}"
+            fi
         fi
     done
 }