Snap for 7137523 from 242e93ed45258ba0142f5a3faaf1c5e9b2dfca7c to sc-release

Change-Id: I4e12cc152df4db74aca4962e83d954b70aa4e34e
diff --git a/com.android.art-arm.apex b/com.android.art-arm.apex
index 5f1b904..5e94a03 100644
--- a/com.android.art-arm.apex
+++ b/com.android.art-arm.apex
Binary files differ
diff --git a/com.android.art-arm64.apex b/com.android.art-arm64.apex
index f23482e..9c72031 100644
--- a/com.android.art-arm64.apex
+++ b/com.android.art-arm64.apex
Binary files differ
diff --git a/com.android.art-x86.apex b/com.android.art-x86.apex
index b9bc8a5..2cc973d 100644
--- a/com.android.art-x86.apex
+++ b/com.android.art-x86.apex
Binary files differ
diff --git a/com.android.art-x86_64.apex b/com.android.art-x86_64.apex
index 734f44b..f1e4cc0 100644
--- a/com.android.art-x86_64.apex
+++ b/com.android.art-x86_64.apex
Binary files differ
diff --git a/com.android.art.debug-arm.apex b/com.android.art.debug-arm.apex
index be2488a..9a2afd0 100644
--- a/com.android.art.debug-arm.apex
+++ b/com.android.art.debug-arm.apex
Binary files differ
diff --git a/com.android.art.debug-arm64.apex b/com.android.art.debug-arm64.apex
index f4bc56f..8850b41 100644
--- a/com.android.art.debug-arm64.apex
+++ b/com.android.art.debug-arm64.apex
Binary files differ
diff --git a/com.android.art.debug-x86.apex b/com.android.art.debug-x86.apex
index 9ff26f7..81f1f3d 100644
--- a/com.android.art.debug-x86.apex
+++ b/com.android.art.debug-x86.apex
Binary files differ
diff --git a/com.android.art.debug-x86_64.apex b/com.android.art.debug-x86_64.apex
index aa2cf39..6e3f5fb 100644
--- a/com.android.art.debug-x86_64.apex
+++ b/com.android.art.debug-x86_64.apex
Binary files differ
diff --git a/update-art-module-prebuilts.py b/update-art-module-prebuilts.py
index b980264..5ec8b0f 100755
--- a/update-art-module-prebuilts.py
+++ b/update-art-module-prebuilts.py
@@ -53,6 +53,8 @@
     "source_path",
     # Local install path
     "install_path",
+    # True if this is a module SDK, to be skipped by --skip-module-sdk.
+    "module_sdk",
     # True if the entry is a zip file that should be unzipped to install_path
     "install_unzipped",
 ])
@@ -64,6 +66,7 @@
     res.append(InstallEntry(
         os.path.join(arch, apex_name + ".apex"),
         os.path.join(PACKAGE_PATH, apex_name + "-" + arch + ".apex"),
+        module_sdk=False,
         install_unzipped=False))
   return res
 
@@ -73,6 +76,7 @@
       os.path.join("mainline-sdks",
                    mainline_sdk_name + "-" + SDK_VERSION + ".zip"),
       os.path.join(SDK_PATH, SDK_VERSION, sdk_dir),
+      module_sdk=True,
       install_unzipped=True)]
 
 
@@ -288,6 +292,10 @@
   parser.add_argument("--local-dist", metavar="PATH",
                       help="Take prebuilts from this local dist dir instead of "
                       "using fetch_artifact")
+  parser.add_argument("--skip-apex", action="store_true",
+                      help="Do not fetch .apex files.")
+  parser.add_argument("--skip-module-sdk", action="store_true",
+                      help="Do not fetch and unpack sdk and module_export zips.")
   parser.add_argument("--skip-cls", action="store_true",
                       help="Do not create branches or git commits")
   parser.add_argument("--upload", action="store_true",
@@ -307,7 +315,15 @@
   if any(path for path in GIT_PROJECT_ROOTS if not os.path.exists(path)):
     sys.exit("This script must be run in the root of the Android build tree.")
 
-  install_paths = [entry.install_path for entry in install_entries]
+  entries = install_entries
+  if args.skip_apex:
+    entries = [entry for entry in entries if entry.module_sdk]
+  if args.skip_module_sdk:
+    entries = [entry for entry in entries if not entry.module_sdk]
+  if not entries:
+    sys.exit("Both APEXes and SDKs skipped - nothing to do.")
+
+  install_paths = [entry.install_path for entry in entries]
   install_paths_per_root = install_paths_per_git_root(
       GIT_PROJECT_ROOTS, install_paths)
 
@@ -320,14 +336,14 @@
 
   for git_root, subpaths in install_paths_per_root.items():
     remove_files(git_root, subpaths, not args.skip_cls)
-  for entry in install_entries:
+  for entry in entries:
     install_entry(args.build, args.local_dist, entry)
 
   # Postprocess the Android.bp files in the SDK snapshot to control prefer flags
   # on the prebuilts through SOONG_CONFIG_art_module_source_build.
   # TODO(b/174997203): Replace this with a better way to control prefer flags on
   # Mainline module prebuilts.
-  for entry in install_entries:
+  for entry in entries:
     if entry.install_unzipped:
       bp_path = os.path.join(entry.install_path, "Android.bp")
       if os.path.exists(bp_path):