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
Merged-In: Ie4732ee602983047859b29b939585a3f716d5bdc
diff --git a/build/apex/Android.bp b/build/apex/Android.bp
index a90881c..ed335c4 100644
--- a/build/apex/Android.bp
+++ b/build/apex/Android.bp
@@ -170,11 +170,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
@@ -246,8 +241,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,
@@ -393,7 +389,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 8b7d980..5390fb2 100644
--- a/libartservice/Android.bp
+++ b/libartservice/Android.bp
@@ -82,6 +82,11 @@
     //   running "m update-api" will give instructions on what to do next
     unsafe_ignore_missing_latest_api: true,
 
+    // 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",
     ],