Introduce Make variables for the various Runtime APEX names.

Test: make systemimage (with user lunch target)
Test: make systemimage (with userdebug/eng lunch target)
Test: art/build/apex/runtests.sh
Bug: 129534335
Change-Id: I69a06acc777acba17deb5e32061d1099ae82beaf
diff --git a/Android.mk b/Android.mk
index 304a19a..bdf81dc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -316,16 +316,19 @@
 
 include $(CLEAR_VARS)
 
-# The Android Runtime APEX comes in two flavors:
+# The Android Runtime APEX comes in three flavors:
 # - the release module (`com.android.runtime.release`), containing
 #   only "release" artifacts;
 # - the debug module (`com.android.runtime.debug`), containing both
-#   "release" and "debug" artifacts, as well as additional tools.
+#   "release" and "debug" artifacts, as well as additional tools;
+# - the testing module (`com.android.runtime.testing`), containing
+#   both "release" and "debug" artifacts, as well as additional tools
+#   and ART gtests).
 #
 # The Android Runtime APEX module (`com.android.runtime`) is an
-# "alias" for one of the previous modules. By default, "user" build
-# variants contain the release module, while "userdebug" and "eng"
-# build variant contain the debug module. However, if
+# "alias" for either the release or the debug module. By default,
+# "user" build variants contain the release module, while "userdebug"
+# and "eng" build variants contain the debug module. However, if
 # `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is defined, it overrides
 # the previous logic:
 # - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `false`, the
@@ -343,11 +346,11 @@
 ifeq (true,$(art_target_include_debug_build))
   # Module with both release and debug variants, as well as
   # additional tools.
-  TARGET_RUNTIME_APEX := com.android.runtime.debug
+  TARGET_RUNTIME_APEX := $(DEBUG_RUNTIME_APEX)
   APEX_TEST_MODULE := art-check-debug-apex-gen-fakebin
 else
   # Release module (without debug variants nor tools).
-  TARGET_RUNTIME_APEX := com.android.runtime.release
+  TARGET_RUNTIME_APEX := $(RELEASE_RUNTIME_APEX)
   APEX_TEST_MODULE := art-check-release-apex-gen-fakebin
 endif
 
@@ -570,15 +573,15 @@
 # TODO(b/129332183): Remove this when Golem has full support for the
 # Runtime APEX.
 .PHONY: standalone-apex-files
-standalone-apex-files: libc.bootstrap libdl.bootstrap libm.bootstrap linker com.android.runtime.debug
+standalone-apex-files: libc.bootstrap libdl.bootstrap libm.bootstrap linker $(DEBUG_RUNTIME_APEX)
 	for f in $(PRIVATE_BIONIC_FILES); do \
 	  tf=$(TARGET_OUT)/$$f; \
 	  if [ -f $$tf ]; then cp -f $$tf $$(echo $$tf | sed 's,bootstrap/,,'); fi; \
 	done
 	if [ "x$(TARGET_FLATTEN_APEX)" = xtrue ]; then \
-	  runtime_apex_orig_dir=$(TARGET_OUT)/apex/com.android.runtime.debug; \
+	  runtime_apex_orig_dir=$(TARGET_OUT)/apex/$(DEBUG_RUNTIME_APEX); \
 	else \
-	  runtime_apex_orig_dir=$(TARGET_OUT)/../apex/com.android.runtime.debug; \
+	  runtime_apex_orig_dir=$(TARGET_OUT)/../apex/$(DEBUG_RUNTIME_APEX); \
 	fi; \
 	for f in $(PRIVATE_RUNTIME_DEPENDENCY_LIBS); do \
 	  tf="$$runtime_apex_orig_dir/$$f"; \
diff --git a/build/Android.common_path.mk b/build/Android.common_path.mk
index 625444f..b0bd7fd 100644
--- a/build/Android.common_path.mk
+++ b/build/Android.common_path.mk
@@ -147,4 +147,12 @@
 ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_DEBUGGABLE_EXECUTABLES),$(name)d-host)
 endif
 
+# Release Runtime APEX, included by default in "user" builds.
+RELEASE_RUNTIME_APEX := com.android.runtime.release
+# Debug Runtime APEX, included by default in "userdebug" and "eng"
+# builds and used in ART device testing and benchmarking.
+DEBUG_RUNTIME_APEX := com.android.runtime.debug
+# Testing Runtime APEX (not used yet).
+TESTING_RUNTIME_APEX := com.android.runtime.testing
+
 endif # ART_ANDROID_COMMON_PATH_MK
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index ff0f891..0c64733 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -286,7 +286,7 @@
   $(HOST_OUT_EXECUTABLES)/dexoptanalyzerd
 ART_GTEST_dexoptanalyzer_test_TARGET_DEPS := \
   $(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS) \
-  com.android.runtime.debug  # For dexoptanalyzerd.
+  $(DEBUG_RUNTIME_APEX)  # For dexoptanalyzerd.
 
 ART_GTEST_image_space_test_HOST_DEPS := \
   $(ART_GTEST_dex2oat_environment_tests_HOST_DEPS)
@@ -298,21 +298,21 @@
   $(HOST_OUT_EXECUTABLES)/dex2oatd
 ART_GTEST_dex2oat_test_TARGET_DEPS := \
   $(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS) \
-  com.android.runtime.debug  # For dex2oatd.
+  $(DEBUG_RUNTIME_APEX)  # For dex2oatd.
 
 ART_GTEST_dex2oat_image_test_HOST_DEPS := \
   $(ART_GTEST_dex2oat_environment_tests_HOST_DEPS) \
   $(HOST_OUT_EXECUTABLES)/dex2oatd
 ART_GTEST_dex2oat_image_test_TARGET_DEPS := \
   $(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS) \
-  com.android.runtime.debug  # For dex2oatd.
+  $(DEBUG_RUNTIME_APEX)  # For dex2oatd.
 
 # TODO: document why this is needed.
 ART_GTEST_proxy_test_HOST_DEPS := $(HOST_CORE_IMAGE_DEFAULT_64) $(HOST_CORE_IMAGE_DEFAULT_32)
 
 # The dexdiag test requires the dexdiag utility.
 ART_GTEST_dexdiag_test_HOST_DEPS := $(HOST_OUT_EXECUTABLES)/dexdiag
-ART_GTEST_dexdiag_test_TARGET_DEPS := com.android.runtime.debug  # For dexdiag.
+ART_GTEST_dexdiag_test_TARGET_DEPS := $(DEBUG_RUNTIME_APEX)  # For dexdiag.
 
 # The dexdump test requires an image and the dexdump utility.
 # TODO: rename into dexdump when migration completes
@@ -356,7 +356,7 @@
 ART_GTEST_dexlist_test_TARGET_DEPS := \
   $(TARGET_CORE_IMAGE_DEFAULT_64) \
   $(TARGET_CORE_IMAGE_DEFAULT_32) \
-  com.android.runtime.debug   # For dexlist.
+  $(DEBUG_RUNTIME_APEX)   # For dexlist.
 
 # The imgdiag test has dependencies on core.oat since it needs to load it during the test.
 # For the host, also add the installed tool (in the base size, that should suffice). For the
@@ -388,7 +388,7 @@
 ART_GTEST_oatdump_test_TARGET_DEPS := \
   $(TARGET_CORE_IMAGE_DEFAULT_64) \
   $(TARGET_CORE_IMAGE_DEFAULT_32) \
-  com.android.runtime.debug    # For oatdumpd, dexdump, dex2oatd.
+  $(DEBUG_RUNTIME_APEX)    # For oatdumpd, dexdump, dex2oatd.
 ART_GTEST_oatdump_image_test_HOST_DEPS := $(ART_GTEST_oatdump_test_HOST_DEPS)
 ART_GTEST_oatdump_image_test_TARGET_DEPS := $(ART_GTEST_oatdump_test_TARGET_DEPS)
 ART_GTEST_oatdump_app_test_HOST_DEPS := $(ART_GTEST_oatdump_test_HOST_DEPS)
@@ -396,7 +396,7 @@
 
 # Profile assistant tests requires profman utility.
 ART_GTEST_profile_assistant_test_HOST_DEPS := $(HOST_OUT_EXECUTABLES)/profmand
-ART_GTEST_profile_assistant_test_TARGET_DEPS := com.android.runtime.debug  # For profmand.
+ART_GTEST_profile_assistant_test_TARGET_DEPS := $(DEBUG_RUNTIME_APEX)  # For profmand.
 
 ART_GTEST_hiddenapi_test_HOST_DEPS := \
   $(HOST_CORE_IMAGE_DEFAULT_64) \
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index e9a55aa..6f182b1 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -29,7 +29,7 @@
 # Runtime APEX) -- which contains dex2oat and dalvikvm and their
 # dependencies -- on the target, as well as the core images (all images
 # as we sync only once).
-ART_TEST_TARGET_RUN_TEST_DEPENDENCIES := com.android.runtime.debug $(TARGET_CORE_IMG_OUTS)
+ART_TEST_TARGET_RUN_TEST_DEPENDENCIES := $(DEBUG_RUNTIME_APEX) $(TARGET_CORE_IMG_OUTS)
 
 # Also need libartagent.
 ART_TEST_TARGET_RUN_TEST_DEPENDENCIES += libartagent-target libartagentd-target