Merge changes from topic "art-enable-apex-libs"

* changes:
  Revert^2 "Switch from version script to APEX stubs for libdexfile_external and add it to the Runtime APEX."
  Add remaining libnative* libs to the Runtime APEX.
diff --git a/build/apex/Android.bp b/build/apex/Android.bp
index 9abf3fe..f7ed826 100644
--- a/build/apex/Android.bp
+++ b/build/apex/Android.bp
@@ -13,11 +13,15 @@
 ]
 // - Base requirements (libraries).
 art_runtime_base_native_shared_libs = [
+    "libadbconnection",
     "libart",
     "libart-compiler",
+    "libdexfile_external",
+    "libnativebridge",
+    "libnativehelper",
+    "libnativeloader",
     "libopenjdkjvm",
     "libopenjdkjvmti",
-    "libadbconnection",
 ]
 bionic_native_shared_libs = [
     "libc",
@@ -41,11 +45,11 @@
 
 // - Debug variants (libraries).
 art_runtime_debug_native_shared_libs = [
+    "libadbconnectiond",
     "libartd",
     "libartd-compiler",
     "libopenjdkjvmd",
     "libopenjdkjvmtid",
-    "libadbconnectiond",
 ]
 libcore_debug_native_shared_libs = [
     "libopenjdkd",
diff --git a/build/apex/art_apex_test.py b/build/apex/art_apex_test.py
index 1abc466..84013f6 100755
--- a/build/apex/art_apex_test.py
+++ b/build/apex/art_apex_test.py
@@ -353,6 +353,10 @@
     self._checker.check_library('libartpalette.so')
     self._checker.check_no_library('libartpalette-system.so')
     self._checker.check_library('libdexfile.so')
+    self._checker.check_library('libdexfile_external.so')
+    self._checker.check_library('libnativebridge.so')
+    self._checker.check_library('libnativehelper.so')
+    self._checker.check_library('libnativeloader.so')
     self._checker.check_library('libopenjdkjvm.so')
     self._checker.check_library('libopenjdkjvmti.so')
     self._checker.check_library('libprofile.so')
diff --git a/build/apex/ld.config.txt b/build/apex/ld.config.txt
index 9bf2ae5..3cfda65 100644
--- a/build/apex/ld.config.txt
+++ b/build/apex/ld.config.txt
@@ -30,6 +30,7 @@
 namespace.platform.asan.search.paths = /data/asan/system/${LIB}
 namespace.platform.links = default
 namespace.platform.link.default.shared_libs  = libart.so:libartd.so
+namespace.platform.link.default.shared_libs += libdexfile_external.so
 namespace.platform.link.default.shared_libs += libnativebridge.so
 namespace.platform.link.default.shared_libs += libnativehelper.so
 namespace.platform.link.default.shared_libs += libnativeloader.so
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index f83f18c..feb5e38 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -228,28 +228,9 @@
         "libdexfile",
     ],
 
-    // TODO(b/120670568): Enable this when linking bug is fixed.
-    // stubs: {
-    //     symbol_file: "external/libdexfile_external.map.txt",
-    //     versions: ["1"],
-    // },
-
-    // Hide symbols using version scripts for targets that support it, i.e. all
-    // but Darwin.
-    // TODO(b/120670568): Clean this up when stubs above is enabled.
-    target: {
-        android: {
-            version_script: "external/libdexfile_external.map.txt",
-        },
-        linux_bionic: {
-            version_script: "external/libdexfile_external.map.txt",
-        },
-        linux_glibc: {
-            version_script: "external/libdexfile_external.map.txt",
-        },
-        windows: {
-            version_script: "external/libdexfile_external.map.txt",
-        },
+    stubs: {
+        symbol_file: "external/libdexfile_external.map.txt",
+        versions: ["1"],
     },
 }
 
diff --git a/oatdump/Android.bp b/oatdump/Android.bp
index 8849a7a..fd0dee3 100644
--- a/oatdump/Android.bp
+++ b/oatdump/Android.bp
@@ -99,6 +99,8 @@
     ],
     // We need this to resolve libartpalette symbols
     // correctly. Multiple source libraries depend on it.
+    // TODO(b/122885634): This is also necessary for the static lib ordering bug
+    // with APEX stubs.
     group_static_libs: true,
 }