Add android-vm-sc to PFQ

BUG=b:179090694
TEST=none

Cq-Depend: chrome-internal:3595247
Change-Id: Ia630c63d08616948053132475238979a81b6009b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2679152
Reviewed-by: Dhanya Ganesh <dhanyaganesh@chromium.org>
Reviewed-by: Sean McAllister <smcallis@google.com>
Reviewed-by: Morg <morg@chromium.org>
Commit-Queue: Richard Fung <richardfung@google.com>
Tested-by: Richard Fung <richardfung@google.com>
diff --git a/config/chromeos_config.py b/config/chromeos_config.py
index 94620ae..277a2db 100644
--- a/config/chromeos_config.py
+++ b/config/chromeos_config.py
@@ -1203,6 +1203,16 @@
       android_import_branch=constants.ANDROID_VMRVC_BUILD_BRANCH,
   )
 
+  # Template for Android VM Sc.
+  site_config.AddTemplate(
+      'vmsc_android_pfq',
+      site_config.templates.generic_android_pfq,
+      site_config.templates.internal,
+      display_label=config_lib.DISPLAY_LABEL_VMSC_ANDROID_PFQ,
+      android_package='android-vm-sc',
+      android_import_branch=constants.ANDROID_VMSC_BUILD_BRANCH,
+  )
+
   # Template for Android VM Master.
   site_config.AddTemplate(
       'vmmst_android_pfq',
diff --git a/lib/config_lib.py b/lib/config_lib.py
index dfb4de1..48b427a 100644
--- a/lib/config_lib.py
+++ b/lib/config_lib.py
@@ -12,7 +12,6 @@
 import json
 import numbers
 import os
-import re
 
 from chromite.lib import constants
 from chromite.lib import osutils
@@ -42,6 +41,7 @@
 DISPLAY_LABEL_QT_ANDROID_PFQ = 'qt_android_pfq'
 DISPLAY_LABEL_RVC_ANDROID_PFQ = 'rvc_android_pfq'
 DISPLAY_LABEL_VMRVC_ANDROID_PFQ = 'vmrvc_android_pfq'
+DISPLAY_LABEL_VMSC_ANDROID_PFQ = 'vmsc_android_pfq'
 DISPLAY_LABEL_FIRMWARE = 'firmware'
 DISPLAY_LABEL_FACTORY = 'factory'
 DISPLAY_LABEL_TOOLCHAIN = 'toolchain'
diff --git a/lib/constants.py b/lib/constants.py
index dfe5b88..5526acb 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -271,6 +271,7 @@
 ANDROID_BUCKET_URL = 'gs://android-build-chromeos/builds'
 ANDROID_PI_BUILD_BRANCH = 'git_pi-arc'
 ANDROID_VMRVC_BUILD_BRANCH = 'git_rvc-arc'
+ANDROID_VMSC_BUILD_BRANCH = 'git_sc-arc-dev'
 ANDROID_VMMST_BUILD_BRANCH = 'git_master-arc-dev'
 
 ANDROID_PI_BUILD_TARGETS = {
@@ -320,6 +321,17 @@
                          (r'(\.zip|/XkbToKcmConverter'
                           r'|/org.chromium.arc.cts.helpers.apk)$')),
 }
+ANDROID_VMSC_BUILD_TARGETS = {
+    # For XkbToKcmConverter, see the comment in ANDROID_PI_BUILD_TARGETS.
+    # org.chromium.cts.helpers.apk contains helpers needed for CTS.  It is
+    # installed on the board, but not into the VM.
+    'ARM64_USERDEBUG': ('linux-bertha_arm64-userdebug',
+                        (r'(\.zip|/XkbToKcmConverter'
+                         r'|/org.chromium.arc.cts.helpers.apk)$')),
+    'X86_64_USERDEBUG': ('linux-bertha_x86_64-userdebug',
+                         (r'(\.zip|/XkbToKcmConverter'
+                          r'|/org.chromium.arc.cts.helpers.apk)$')),
+}
 
 # These refer to *_TARGET variables in Android ebuild files, used when
 # parsing ebuilds to determine the corresponding Android branch.
@@ -330,6 +342,7 @@
         ANDROID_PI_BUILD_TARGETS,
         ANDROID_VMMST_BUILD_TARGETS,
         ANDROID_VMRVC_BUILD_TARGETS,
+        ANDROID_VMSC_BUILD_TARGETS,
     )
 )
 
@@ -877,6 +890,7 @@
 VMMST_ANDROID_PFQ_MASTER = 'master-vmmst-android-pfq'
 PI_ANDROID_PFQ_MASTER = 'master-pi-android-pfq'
 VMRVC_ANDROID_PFQ_MASTER = 'master-vmrvc-android-pfq'
+VMSC_ANDROID_PFQ_MASTER = 'master-vmsc-android-pfq'
 TOOLCHAIN_MASTTER = 'master-toolchain'
 
 
diff --git a/scripts/cros_mark_android_as_stable.py b/scripts/cros_mark_android_as_stable.py
index a2db316..04f9d95 100644
--- a/scripts/cros_mark_android_as_stable.py
+++ b/scripts/cros_mark_android_as_stable.py
@@ -382,6 +382,8 @@
         constants.ANDROID_VMMST_BUILD_TARGETS,
         constants.ANDROID_VMRVC_BUILD_BRANCH:
         constants.ANDROID_VMRVC_BUILD_TARGETS,
+        constants.ANDROID_VMSC_BUILD_BRANCH:
+        constants.ANDROID_VMSC_BUILD_TARGETS,
     }
   else:
     raise ValueError('Unknown package: %s' % package_name)
diff --git a/scripts/cros_mark_android_as_stable_unittest.py b/scripts/cros_mark_android_as_stable_unittest.py
index 54974ef..3618266 100644
--- a/scripts/cros_mark_android_as_stable_unittest.py
+++ b/scripts/cros_mark_android_as_stable_unittest.py
@@ -455,6 +455,11 @@
         constants.ANDROID_VM_PACKAGE_KEYWORD,
         constants.ANDROID_VMRVC_BUILD_BRANCH).keys():
       self.assertIn(t, acls)
+    # Test that all VMSC targets have their ACLS set.
+    for t in cros_mark_android_as_stable.MakeBuildTargetDict(
+        constants.ANDROID_VM_PACKAGE_KEYWORD,
+        constants.ANDROID_VMSC_BUILD_BRANCH).keys():
+      self.assertIn(t, acls)
     # Test that all VMMST targets have their ACLS set.
     for t in cros_mark_android_as_stable.MakeBuildTargetDict(
         constants.ANDROID_VM_PACKAGE_KEYWORD,