Initial layout of ART Service files
This CL contains the initial scaffolding for the ART Service project.
This contains a Java Language library for loading into the System
Server and two native support libraries. At this moment these libraries
contain simple "Hello World" stubs.
Test: Build each of the libraries
Test: art/build/apex/runtests.sh
Bug: 177273468
Change-Id: I597ce336a9ddc14d7b407efef7c1e34f5a4a46ae
diff --git a/build/apex/Android.bp b/build/apex/Android.bp
index 78770db..8b6df9d 100644
--- a/build/apex/Android.bp
+++ b/build/apex/Android.bp
@@ -51,12 +51,16 @@
// dependencies work with APEX libraries.
"libart",
"libart-compiler",
+ "libartservice",
"libdt_fd_forward",
"libdt_socket",
"libjdwp",
"libnpt",
"libopenjdkjvm",
"libopenjdkjvmti",
+ // TODO(chriswailes): Make libarttools a dependency for another target
+ // when such a target exists
+ "libarttools",
]
art_runtime_base_native_device_only_shared_libs = [
@@ -158,6 +162,11 @@
"apache-xml",
]
+// ART Java libraries
+art_java_libs = [
+ "artservice",
+]
+
// Native libraries that support the core Java libraries.
//
// Note: ART on-device chroot-based testing and benchmarking is not yet using
@@ -229,7 +238,7 @@
compile_multilib: "both",
manifest: "manifest-art.json",
boot_images: ["art-boot-image"],
- java_libs: libcore_java_libs,
+ java_libs: libcore_java_libs + art_java_libs,
native_shared_libs: art_runtime_base_native_shared_libs +
art_runtime_base_native_device_only_shared_libs +
libcore_native_shared_libs,
@@ -353,7 +362,7 @@
host_supported: true,
device_supported: false,
manifest: "manifest-art.json",
- java_libs: libcore_java_libs,
+ java_libs: libcore_java_libs + art_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/apex/art_apex_test.py b/build/apex/art_apex_test.py
index 498ee95..fbe6223 100755
--- a/build/apex/art_apex_test.py
+++ b/build/apex/art_apex_test.py
@@ -540,6 +540,8 @@
self._checker.check_native_library('libart-disassembler')
self._checker.check_native_library('libartbase')
self._checker.check_native_library('libartpalette')
+ self._checker.check_native_library('libartservice')
+ self._checker.check_native_library('libarttools')
self._checker.check_native_library('libdexfile')
self._checker.check_native_library('libdexfile_support')
self._checker.check_native_library('libdt_fd_forward')
@@ -548,6 +550,9 @@
self._checker.check_native_library('libprofile')
self._checker.check_native_library('libsigchain')
+ # Check internal Java libraries
+ self._checker.check_java_library("artservice")
+
# Check java libraries for Managed Core Library.
self._checker.check_java_library('apache-xml')
self._checker.check_java_library('bouncycastle')
diff --git a/libartservice/Android.bp b/libartservice/Android.bp
new file mode 100644
index 0000000..c629cfb
--- /dev/null
+++ b/libartservice/Android.bp
@@ -0,0 +1,62 @@
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_library {
+ // This native library contains JNI support code for the ART Service Java
+ // Language library.
+
+ name: "libartservice",
+ host_supported: true,
+ srcs: [
+ "service/native/service.cc",
+ ],
+ export_include_dirs: ["."],
+ apex_available: [
+ "com.android.art",
+ "com.android.art.debug",
+ ],
+ shared_libs: [
+ "libbase",
+ ],
+ export_shared_lib_headers: ["libbase"],
+ cflags: ["-Werror"],
+}
+
+java_library {
+ // This Java Language Library contains the ART Service class that will be
+ // loaded by the System Server.
+
+ name: "artservice",
+ visibility: [
+ "//art:__subpackages__",
+ ],
+
+ apex_available: [
+ "com.android.art",
+ "com.android.art.debug",
+ ],
+
+ sdk_version: "core_platform",
+
+ srcs: [
+ "service/java/com/android/server/art/ArtService.java",
+ ],
+
+ libs: [
+ "art.module.api.annotations.for.system.modules",
+ "unsupportedappusage",
+ ],
+
+ plugins: ["java_api_finder"],
+}
diff --git a/libartservice/service/java/com/android/server/art/ArtService.java b/libartservice/service/java/com/android/server/art/ArtService.java
new file mode 100644
index 0000000..bfc870e
--- /dev/null
+++ b/libartservice/service/java/com/android/server/art/ArtService.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.art;
+
+import libcore.api.CorePlatformApi;
+
+/**
+ * This class provides a system API for functionality provided by the ART
+ * module.
+ */
+@libcore.api.CorePlatformApi(status = CorePlatformApi.Status.STABLE)
+public final class ArtService {
+ static final String LOG_TAG = "ArtService";
+
+ static String getMsg() {
+ return "Hello world!";
+ }
+}
diff --git a/libartservice/service/native/service.cc b/libartservice/service/native/service.cc
new file mode 100644
index 0000000..d33cb59
--- /dev/null
+++ b/libartservice/service/native/service.cc
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "service.h"
+
+namespace art {
+namespace service {
+
+std::string getMsg() {
+ return "hello world!";
+}
+
+}
+}
diff --git a/libartservice/service/native/service.h b/libartservice/service/native/service.h
new file mode 100644
index 0000000..2b680a2
--- /dev/null
+++ b/libartservice/service/native/service.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_LIBARTSERVICE_SERVICE_NATIVE_SERVICE_H_
+#define ART_LIBARTSERVICE_SERVICE_NATIVE_SERVICE_H_
+
+#include <string>
+
+namespace art {
+namespace service {
+
+std::string getMsg();
+
+} // namespace service
+} // namespace art
+
+#endif // ART_LIBARTSERVICE_SERVICE_NATIVE_SERVICE_H_
diff --git a/libarttools/Android.bp b/libarttools/Android.bp
new file mode 100644
index 0000000..b602f4f
--- /dev/null
+++ b/libarttools/Android.bp
@@ -0,0 +1,37 @@
+//
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library {
+ // This library contains low-level interfaces used to call dex2oat and
+ // related tools. It will translate structured messages into command line
+ // arguments. This will allow other libraries or programs besides the ART
+ // Service to make use of this functionality.
+
+ name: "libarttools",
+ host_supported: true,
+ srcs: [
+ "tools/tools.cc",
+ ],
+ export_include_dirs: ["."],
+ apex_available: [
+ "com.android.art",
+ "com.android.art.debug",
+ ],
+ shared_libs: [
+ "libbase",
+ ],
+ export_shared_lib_headers: ["libbase"],
+}
diff --git a/libarttools/tools/tools.cc b/libarttools/tools/tools.cc
new file mode 100644
index 0000000..a3a91e8
--- /dev/null
+++ b/libarttools/tools/tools.cc
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tools.h"
+
+namespace art {
+namespace tools {
+
+std::string getMsg() {
+ return "hello world!";
+}
+
+}
+}
diff --git a/libarttools/tools/tools.h b/libarttools/tools/tools.h
new file mode 100644
index 0000000..8231f5f
--- /dev/null
+++ b/libarttools/tools/tools.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_LIBARTTOOLS_TOOLS_TOOLS_H_
+#define ART_LIBARTTOOLS_TOOLS_TOOLS_H_
+
+#include <string>
+
+namespace art {
+namespace tools {
+
+std::string getMsg();
+
+} // namespace tools
+} // namespace art
+
+#endif // ART_LIBARTTOOLS_TOOLS_TOOLS_H_