Use framework boot image extension.

Test: m
Test: ran art tests on device (all passed)

Bug: b/119800099

Change-Id: I5e417cd2588ae7b88e7b6abf7ae54268d2cce5f8
diff --git a/build/apex/art_apex_test.py b/build/apex/art_apex_test.py
index 9e4f46a..f41725a 100755
--- a/build/apex/art_apex_test.py
+++ b/build/apex/art_apex_test.py
@@ -542,17 +542,13 @@
     self._checker.check_optional_native_library('libclang_rt.hwasan*')
     self._checker.check_optional_native_library('libclang_rt.ubsan*')
 
-    # Check dexpreopt files for libcore bootclasspath jars, unless this is a
-    # coverage build with EMMA_INSTRUMENT_FRAMEWORK=true (in that case we do not
-    # generate dexpreopt files because ART boot jars depend on framework and
-    # cannot be dexpreopted in isolation).
-    if 'EMMA_INSTRUMENT_FRAMEWORK' not in os.environ or not os.environ['EMMA_INSTRUMENT_FRAMEWORK']:
-      self._checker.check_dexpreopt('boot')
-      self._checker.check_dexpreopt('boot-apache-xml')
-      self._checker.check_dexpreopt('boot-bouncycastle')
-      self._checker.check_dexpreopt('boot-core-icu4j')
-      self._checker.check_dexpreopt('boot-core-libart')
-      self._checker.check_dexpreopt('boot-okhttp')
+    # Check dexpreopt files for libcore bootclasspath jars
+    self._checker.check_dexpreopt('boot')
+    self._checker.check_dexpreopt('boot-apache-xml')
+    self._checker.check_dexpreopt('boot-bouncycastle')
+    self._checker.check_dexpreopt('boot-core-icu4j')
+    self._checker.check_dexpreopt('boot-core-libart')
+    self._checker.check_dexpreopt('boot-okhttp')
 
 class ReleaseTargetChecker:
   def __init__(self, checker):
diff --git a/build/apex/ld.config.txt b/build/apex/ld.config.txt
index cadddc2..86c3137 100644
--- a/build/apex/ld.config.txt
+++ b/build/apex/ld.config.txt
@@ -38,9 +38,10 @@
 # TODO(b/129534335): Move this to the linker configuration of the Test
 # ART APEX when it is available.
 namespace.art.permitted.paths = /data
-# odex files are in /system/framework. dalvikvm has to be able to dlopen the
-# files for CTS.
+# odex files are in /system/framework and /apex/com.android.art/javalib.
+# dalvikvm has to be able to dlopen the files for CTS.
 namespace.art.permitted.paths += /system/framework
+namespace.art.permitted.paths += /apex/com.android.art/javalib
 namespace.art.links = platform,neuralnetworks
 # Need allow_all_shared_libs because libart.so can dlopen oat files in
 # /system/framework and /data.
diff --git a/libartbase/base/file_utils.cc b/libartbase/base/file_utils.cc
index 5e164ec..beee348 100644
--- a/libartbase/base/file_utils.cc
+++ b/libartbase/base/file_utils.cc
@@ -275,7 +275,12 @@
 }
 
 std::string GetDefaultBootImageLocation(const std::string& android_root) {
-  return StringPrintf("%s/framework/boot.art", android_root.c_str());
+  // Boot image consists of two parts:
+  //  - the primary boot image in the ART apex (contains the Core Libraries)
+  //  - boot image extension on the system partition (contains framework libraries)
+  return StringPrintf("%s/javalib/boot.art:%s/framework/boot-framework.art",
+                      kAndroidArtApexDefaultPath,
+                      android_root.c_str());
 }
 
 std::string GetDefaultBootImageLocation(std::string* error_msg) {