Rename ART release APEX to com.android.art.

Test: Build & boot on AOSP master
Test: `m` on AOSP master, flipping
  PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD between true and false, and
  check out/target/product/bonito/symbols/apex/com.android.art.
Test: art/build/apex/runtests.sh
Test: art/tools/buildbot-build.sh {--host,--target}
Test: art/tools/run-gtests.sh
Test: m test-art-host-gtest
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
Test: m build-art-target-golem
Bug: 169639321
Change-Id: Ic4bb8d6f9988ce99bba326b9c635bd3c01ed74ab
Merged-In: Ic4bb8d6f9988ce99bba326b9c635bd3c01ed74ab
diff --git a/Android.mk b/Android.mk
index 5b829f9..a5c6804 100644
--- a/Android.mk
+++ b/Android.mk
@@ -287,8 +287,8 @@
 include $(CLEAR_VARS)
 
 # The ART APEX comes in three flavors:
-# - the release module (`com.android.art.release`), containing
-#   only "release" artifacts;
+# - the release module (`com.android.art`), containing only "release"
+#   artifacts;
 # - the debug module (`com.android.art.debug`), containing both
 #   "release" and "debug" artifacts, as well as additional tools;
 # - the testing module (`com.android.art.testing`), containing
@@ -339,16 +339,16 @@
 endif
 include $(BUILD_PHONY_PACKAGE)
 
-# Create canonical name -> file name symlink in the symbol directory
-# The symbol files for the debug or release variant are installed to
-# $(TARGET_OUT_UNSTRIPPED)/$(TARGET_ART_APEX) directory. However,
-# since they are available via /apex/com.android.art at runtime
-# regardless of which variant is installed, create a symlink so that
+# Create canonical name -> file name symlink in the symbol directory for the
+# debug APEX. The symbol files for it are installed to
+# $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art.debug. However, since it's
+# available via /apex/com.android.art at runtime, create a symlink so that
 # $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art is linked to
-# $(TARGET_OUT_UNSTRIPPED)/apex/$(TARGET_ART_APEX).
-# Note that installation of the symlink is triggered by the apex_manifest.pb
-# file which is the file that is guaranteed to be created regardless of the
-# value of TARGET_FLATTEN_APEX.
+# $(TARGET_OUT_UNSTRIPPED)/apex/$(TARGET_ART_APEX). We skip this for the release
+# APEX which has com.android.art as $(TARGET_ART_APEX). Note that installation
+# of the symlink is triggered by the apex_manifest.pb file which is the file
+# that is guaranteed to be created regardless of the value of
+# TARGET_FLATTEN_APEX.
 ifeq ($(TARGET_FLATTEN_APEX),true)
 art_apex_manifest_file := $(PRODUCT_OUT)/system/apex/$(TARGET_ART_APEX)/apex_manifest.pb
 else
@@ -359,8 +359,13 @@
 $(art_apex_manifest_file): $(art_apex_symlink_timestamp)
 $(art_apex_manifest_file): PRIVATE_LINK_NAME := $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art
 $(art_apex_symlink_timestamp):
+ifeq ($(TARGET_ART_APEX),com.android.art)
+	$(hide) if [ -L $(PRIVATE_LINK_NAME) ]; then rm -f $(PRIVATE_LINK_NAME); fi
+else
 	$(hide) mkdir -p $(dir $(PRIVATE_LINK_NAME))
+	$(hide) rm -rf $(PRIVATE_LINK_NAME)
 	$(hide) ln -sf $(TARGET_ART_APEX) $(PRIVATE_LINK_NAME)
+endif
 	$(hide) touch $@
 $(art_apex_symlink_timestamp): .KATI_SYMLINK_OUTPUTS := $(PRIVATE_LINK_NAME)
 
@@ -377,16 +382,16 @@
 
 # Base requirements.
 LOCAL_REQUIRED_MODULES := \
-    dalvikvm.com.android.art.release \
-    dex2oat.com.android.art.release \
-    dexoptanalyzer.com.android.art.release \
-    libart.com.android.art.release \
-    libart-compiler.com.android.art.release \
-    libopenjdkjvm.com.android.art.release \
-    libopenjdkjvmti.com.android.art.release \
-    profman.com.android.art.release \
-    libadbconnection.com.android.art.release \
-    libperfetto_hprof.com.android.art.release \
+    dalvikvm.com.android.art \
+    dex2oat.com.android.art \
+    dexoptanalyzer.com.android.art \
+    libart.com.android.art \
+    libart-compiler.com.android.art \
+    libopenjdkjvm.com.android.art \
+    libopenjdkjvmti.com.android.art \
+    profman.com.android.art \
+    libadbconnection.com.android.art \
+    libperfetto_hprof.com.android.art \
 
 # Potentially add in debug variants:
 #
@@ -709,8 +714,6 @@
 	sed -i '/libdexfiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt
 	sed -i '/libprofiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt
 	sed -i '/libartbased.so/d' $(TARGET_OUT)/etc/public.libraries.txt
-	# The 'art' script will look for a 'com.android.art' directory.
-	ln -sf com.android.art.release $(TARGET_OUT)/apex/com.android.art
 
 ########################################################################
 # Phony target for building what go/lem requires on host.
diff --git a/adbconnection/Android.bp b/adbconnection/Android.bp
index b03cd0d..75f6845 100644
--- a/adbconnection/Android.bp
+++ b/adbconnection/Android.bp
@@ -55,7 +55,7 @@
         "libartbase",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/build/Android.common_path.mk b/build/Android.common_path.mk
index 5cf7322..7cb88c3 100644
--- a/build/Android.common_path.mk
+++ b/build/Android.common_path.mk
@@ -113,7 +113,7 @@
 endif
 
 # Release ART APEX, included by default in "user" builds.
-RELEASE_ART_APEX := com.android.art.release
+RELEASE_ART_APEX := com.android.art
 # Debug ART APEX, included by default in "userdebug" and "eng"
 # builds and used in ART device benchmarking.
 DEBUG_ART_APEX := com.android.art.debug
diff --git a/build/apex/Android.bp b/build/apex/Android.bp
index f364187..71b96f4 100644
--- a/build/apex/Android.bp
+++ b/build/apex/Android.bp
@@ -256,7 +256,7 @@
 // variants nor tools), included in user builds. Also used for
 // storage-constrained devices in userdebug and eng builds.
 art_apex {
-    name: "com.android.art.release",
+    name: "com.android.art",
     defaults: ["com.android.art-defaults"],
     certificate: ":com.android.art.certificate",
 }
@@ -410,7 +410,7 @@
 genrule {
     name: "art-check-release-apex-gen",
     defaults: ["art-check-apex-gen-defaults"],
-    srcs: [":com.android.art.release"],
+    srcs: [":com.android.art"],
     cmd: art_check_apex_gen_stem +
         " --flavor release" +
         " $(in)" +
diff --git a/build/apex/art_apex_test.py b/build/apex/art_apex_test.py
index 0a9c591..efe12aa 100755
--- a/build/apex/art_apex_test.py
+++ b/build/apex/art_apex_test.py
@@ -1074,7 +1074,7 @@
   # TODO: Add host support.
   # TODO: Add support for flattened APEX packages.
   configs = [
-    {'name': 'com.android.art.release', 'flavor': FLAVOR_RELEASE, 'host': False},
+    {'name': 'com.android.art',         'flavor': FLAVOR_RELEASE, 'host': False},
     {'name': 'com.android.art.debug',   'flavor': FLAVOR_DEBUG,   'host': False},
     {'name': 'com.android.art.testing', 'flavor': FLAVOR_TESTING, 'host': False},
   ]
diff --git a/build/apex/runtests.sh b/build/apex/runtests.sh
index 7e3f40f..8b19780 100755
--- a/build/apex/runtests.sh
+++ b/build/apex/runtests.sh
@@ -133,7 +133,7 @@
 # Test all modules, if possible.
 
 apex_modules=(
-  "com.android.art.release"
+  "com.android.art"
   "com.android.art.debug"
   "com.android.art.testing"
 )
@@ -181,9 +181,9 @@
       art_apex_test_args="$art_apex_test_args --debugfs $ANDROID_HOST_OUT/bin/debugfs"
     fi
     case $apex_module in
-      (*.release) test_only_args="--flavor release";;
       (*.debug)   test_only_args="--flavor debug";;
       (*.testing) test_only_args="--flavor testing";;
+      (*)         test_only_args="--flavor release";;
     esac
   fi
   say "APEX package path: $apex_path"
diff --git a/cmdline/Android.bp b/cmdline/Android.bp
index 3eac0ed..bc2bf00 100644
--- a/cmdline/Android.bp
+++ b/cmdline/Android.bp
@@ -22,7 +22,7 @@
 
     apex_available: [
         "com.android.art.debug",
-        "com.android.art.release",
+        "com.android.art",
     ],
 }
 
diff --git a/compiler/Android.bp b/compiler/Android.bp
index ffe5133..e91700b 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -254,7 +254,7 @@
         },
     },
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/dalvikvm/Android.bp b/dalvikvm/Android.bp
index 8cd8819..5ca32a7 100644
--- a/dalvikvm/Android.bp
+++ b/dalvikvm/Android.bp
@@ -55,7 +55,7 @@
     // Create symlink for the primary version target.
     symlink_preferred_arch: true,
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index e9158f0..a859d6e 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -97,7 +97,7 @@
         "libprofile",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
@@ -306,7 +306,7 @@
         },
     },
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/dexdump/Android.bp b/dexdump/Android.bp
index c21fb59..372e50c 100644
--- a/dexdump/Android.bp
+++ b/dexdump/Android.bp
@@ -53,7 +53,7 @@
         },
     },
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
         "//apex_available:platform", // for SDK
     ],
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index 04068e1..aea7cf2 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -95,7 +95,7 @@
         },
     },
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
@@ -176,7 +176,7 @@
         "libart-dexlayout",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
@@ -264,7 +264,7 @@
         },
     },
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/dexlist/Android.bp b/dexlist/Android.bp
index 4cb4ad2..f296f17 100644
--- a/dexlist/Android.bp
+++ b/dexlist/Android.bp
@@ -23,7 +23,7 @@
         "libbase",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/dexoptanalyzer/Android.bp b/dexoptanalyzer/Android.bp
index 4207e65..3e4f06f 100644
--- a/dexoptanalyzer/Android.bp
+++ b/dexoptanalyzer/Android.bp
@@ -42,7 +42,7 @@
         "libartbase",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/disassembler/Android.bp b/disassembler/Android.bp
index 452e883..8d473a3 100644
--- a/disassembler/Android.bp
+++ b/disassembler/Android.bp
@@ -53,7 +53,7 @@
         "libvixl",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
@@ -78,7 +78,7 @@
     ],
 
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
@@ -100,6 +100,6 @@
 
     apex_available: [
         "com.android.art.debug",
-        "com.android.art.release",
+        "com.android.art",
     ],
 }
diff --git a/dt_fd_forward/Android.bp b/dt_fd_forward/Android.bp
index e722a4d..6308ad3 100644
--- a/dt_fd_forward/Android.bp
+++ b/dt_fd_forward/Android.bp
@@ -49,7 +49,7 @@
     name: "libdt_fd_forward",
     defaults: ["dt_fd_forward-defaults"],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/dt_fd_forward/export/Android.bp b/dt_fd_forward/export/Android.bp
index 4039196..91cb57f 100644
--- a/dt_fd_forward/export/Android.bp
+++ b/dt_fd_forward/export/Android.bp
@@ -22,6 +22,6 @@
 
     apex_available: [
         "com.android.art.debug",
-        "com.android.art.release",
+        "com.android.art",
     ],
 }
diff --git a/imgdiag/Android.bp b/imgdiag/Android.bp
index db9435b..1edf5d9 100644
--- a/imgdiag/Android.bp
+++ b/imgdiag/Android.bp
@@ -58,7 +58,7 @@
         "libart-compiler",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/libartbase/Android.bp b/libartbase/Android.bp
index 9724035..32f4641 100644
--- a/libartbase/Android.bp
+++ b/libartbase/Android.bp
@@ -161,7 +161,7 @@
         "//packages/modules/NetworkStack/tests:__subpackages__",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 
@@ -279,7 +279,7 @@
     export_shared_lib_headers: ["libbase"],
 
     apex_available: [
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
diff --git a/libartpalette/Android.bp b/libartpalette/Android.bp
index 1cdc270..ea53e00 100644
--- a/libartpalette/Android.bp
+++ b/libartpalette/Android.bp
@@ -89,7 +89,7 @@
         },
     },
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
         // TODO(b/142944931): remove this
         "com.android.runtime", // due to the transitive dependency from linker
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index 6ce66cd..ca0de28 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -176,7 +176,7 @@
         },
     },
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
@@ -273,8 +273,8 @@
 
     apex_available: [
         "//apex_available:platform",
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
 
@@ -286,8 +286,8 @@
     export_include_dirs: ["."],
 
     apex_available: [
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
 
@@ -330,7 +330,7 @@
         "libdexfile",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
@@ -388,8 +388,8 @@
 
     apex_available: [
         "//apex_available:platform",
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
 
diff --git a/libelffile/Android.bp b/libelffile/Android.bp
index 6b2b34f..18ac98c 100644
--- a/libelffile/Android.bp
+++ b/libelffile/Android.bp
@@ -41,7 +41,7 @@
         "libartbase",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/libnativebridge/Android.bp b/libnativebridge/Android.bp
index e6e5fe1..dc53634 100644
--- a/libnativebridge/Android.bp
+++ b/libnativebridge/Android.bp
@@ -22,8 +22,8 @@
 
     apex_available: [
         "//apex_available:platform",
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
 
@@ -36,7 +36,7 @@
         "//frameworks/base/native/webview/loader/libwebviewchromium_loader",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 
diff --git a/libnativeloader/Android.bp b/libnativeloader/Android.bp
index 6a79169..54c6005 100644
--- a/libnativeloader/Android.bp
+++ b/libnativeloader/Android.bp
@@ -19,7 +19,7 @@
         "//frameworks/base/native/webview/loader",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
     host_supported: true,
@@ -87,8 +87,8 @@
     name: "libnativeloader-headers",
     apex_available: [
         "//apex_available:platform",
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
     visibility: [
         "//art:__subpackages__",
diff --git a/libprofile/Android.bp b/libprofile/Android.bp
index d210afa..92a0dcf 100644
--- a/libprofile/Android.bp
+++ b/libprofile/Android.bp
@@ -128,7 +128,7 @@
         },
     },
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/oatdump/Android.bp b/oatdump/Android.bp
index 87f3a69..f955900 100644
--- a/oatdump/Android.bp
+++ b/oatdump/Android.bp
@@ -70,7 +70,7 @@
     },
 
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/openjdkjvm/Android.bp b/openjdkjvm/Android.bp
index ace8d0b..d605a3e 100644
--- a/openjdkjvm/Android.bp
+++ b/openjdkjvm/Android.bp
@@ -35,7 +35,7 @@
         "libartbase",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/openjdkjvmti/Android.bp b/openjdkjvmti/Android.bp
index dca0481..3bb3e5b 100644
--- a/openjdkjvmti/Android.bp
+++ b/openjdkjvmti/Android.bp
@@ -24,8 +24,8 @@
 
     apex_available: [
         "//apex_available:platform",
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
 
@@ -86,7 +86,7 @@
         "libartbase",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/perfetto_hprof/Android.bp b/perfetto_hprof/Android.bp
index 65c072e..4725e1d 100644
--- a/perfetto_hprof/Android.bp
+++ b/perfetto_hprof/Android.bp
@@ -78,7 +78,7 @@
         "libartbase",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/profman/Android.bp b/profman/Android.bp
index 25f7ae3..aab87a9 100644
--- a/profman/Android.bp
+++ b/profman/Android.bp
@@ -48,7 +48,7 @@
         "libartbase",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 1f8e857e..d67ed43 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -574,7 +574,7 @@
         },
     },
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }
@@ -788,8 +788,8 @@
     sdk_version: "current",
 
     apex_available: [
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
 
diff --git a/sigchainlib/Android.bp b/sigchainlib/Android.bp
index 3fb21b9..00156de 100644
--- a/sigchainlib/Android.bp
+++ b/sigchainlib/Android.bp
@@ -44,7 +44,7 @@
 
     export_include_dirs: ["."],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
         // TODO(b/142944043) Clean this up. This is due to the dependency from
         // app_process
diff --git a/tools/Android.bp b/tools/Android.bp
index 7e7c0d4..1b99ae1 100644
--- a/tools/Android.bp
+++ b/tools/Android.bp
@@ -38,7 +38,7 @@
     target: {
         android: {
             required: [
-                "com.android.art.release",
+                "com.android.art",
             ],
         },
         host: {
@@ -61,7 +61,7 @@
     target: {
         android: {
             required: [
-                "com.android.art.release",
+                "com.android.art",
             ],
         },
         host: {
diff --git a/tools/cpp-define-generator/Android.bp b/tools/cpp-define-generator/Android.bp
index 34813cd..fc0d325 100644
--- a/tools/cpp-define-generator/Android.bp
+++ b/tools/cpp-define-generator/Android.bp
@@ -41,8 +41,8 @@
     cflags: ["-S"],
     srcs: ["asm_defines.cc"],
     apex_available: [
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
 
@@ -62,8 +62,8 @@
     },
 
     apex_available: [
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
 
@@ -73,8 +73,8 @@
     export_include_dirs: ["."],
 
     apex_available: [
+        "com.android.art",
         "com.android.art.debug",
-        "com.android.art.release",
     ],
 }
 
diff --git a/tools/dexanalyze/Android.bp b/tools/dexanalyze/Android.bp
index 8f76cae..7547370 100644
--- a/tools/dexanalyze/Android.bp
+++ b/tools/dexanalyze/Android.bp
@@ -38,7 +38,7 @@
         "libbase",
     ],
     apex_available: [
-        "com.android.art.release",
+        "com.android.art",
         "com.android.art.debug",
     ],
 }