Extract common.UnzipToDir, invoke that from merge_target_files.py

This change adds another utility function to common.py: UnzipToDir, which is
generally useful. Refactor merge_target_files.py to use it, and also refactor
other uses in common.py to use it.

Test: ota_from_target_files.py, validate_target_files.py, test_common.py
Bug: 124464492
Change-Id: Ia571070bceb7d3c8002304836bdf688485bf0dd9
diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py
index b2bb020..2645829 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -163,19 +163,13 @@
     else:
       filtered_extract_item_list.append(pattern)
 
-  # Extract the filtered_extract_item_list from target_files into
-  # target_files_temp_dir.
+  # Extract from target_files into target_files_temp_dir the
+  # filtered_extract_item_list.
 
-  # TODO(b/124464492): Extend common.UnzipTemp() to handle this use case.
-  command = [
-      'unzip',
-      '-n',
-      '-q',
-      '-d', target_files_temp_dir,
-      target_files
-  ] + filtered_extract_item_list
-
-  common.RunAndWait(command, verbose=True)
+  common.UnzipToDir(
+      target_files,
+      target_files_temp_dir,
+      filtered_extract_item_list)
 
 
 def process_ab_partitions_txt(