Add systemserverclasspath_fragment.

Note that the contents of the fragment are added as dependencies to an
apex, so there is no need to duplicate them in java_libs.

Bug: 180105615
Test: atest CtsClasspathsTestCases
Change-Id: Ie4732ee602983047859b29b939585a3f716d5bdc
diff --git a/build/apex/Android.bp b/build/apex/Android.bp
index fae3418..c262516 100644
--- a/build/apex/Android.bp
+++ b/build/apex/Android.bp
@@ -172,11 +172,6 @@
     "apache-xml",
 ]
 
-// ART Java libraries
-art_java_libs = [
-    "service-art",
-]
-
 // Native libraries that support the core Java libraries.
 //
 // Note: ART on-device chroot-based testing and benchmarking is not yet using
@@ -248,8 +243,9 @@
     compile_multilib: "both",
     manifest: "manifest-art.json",
     bootclasspath_fragments: ["art-bootclasspath-fragment"],
+    systemserverclasspath_fragments: ["art-systemserverclasspath-fragment"],
     compat_configs: ["libcore-platform-compat-config"],
-    java_libs: libcore_java_libs + art_java_libs,
+    java_libs: libcore_java_libs,
     native_shared_libs: art_runtime_base_native_shared_libs +
         art_runtime_base_native_device_only_shared_libs +
         libcore_native_shared_libs,
@@ -395,7 +391,7 @@
     device_supported: false,
     manifest: "manifest-art.json",
     updatable: false,
-    java_libs: libcore_java_libs + art_java_libs,
+    java_libs: libcore_java_libs,
     ignore_system_library_special_case: true,
     native_shared_libs: art_runtime_base_native_shared_libs +
         art_runtime_debug_native_shared_libs +
diff --git a/build/boot/Android.bp b/build/boot/Android.bp
index 80353ea..64c172b 100644
--- a/build/boot/Android.bp
+++ b/build/boot/Android.bp
@@ -21,6 +21,7 @@
     default_applicable_licenses: ["art_license"],
 }
 
+// Encapsulate the contributions made by the com.android.art to the bootclasspath.
 bootclasspath_fragment {
     name: "art-bootclasspath-fragment",
     image_name: "art",
@@ -75,3 +76,13 @@
         unsupported_packages: ["hiddenapi/hiddenapi-unsupported-packages.txt"],
     },
 }
+
+// Encapsulate the contributions made by the com.android.art to the systemserverclasspath.
+systemserverclasspath_fragment {
+    name: "art-systemserverclasspath-fragment",
+    contents: ["service-art"],
+    apex_available: [
+        "com.android.art",
+        "com.android.art.debug",
+    ],
+}
diff --git a/libartservice/Android.bp b/libartservice/Android.bp
index 55ce1a6..6e91911 100644
--- a/libartservice/Android.bp
+++ b/libartservice/Android.bp
@@ -136,6 +136,8 @@
 
     // This cannot be accessed by apps using <uses-library> in their manifest.
     shared_library: false,
+    // TODO(b/188773212): force dex compilation for inclusion in bootclasspath_fragment.
+    compile_dex: true,
 
     srcs: [
         "service/java/com/android/server/art/ArtManagerLocal.java",