Add a VirtualizationSystemService that runs inside system_server
This service will later be used to subscribe to trigger clean up
routines when an app is deleted.
The code is located in the
/apex/com.android.virt/javalib/service-virtualization.jar. This jar
contributes to the system_server classpath.
The service-virtualization.jar will be installed for both AVF enabled &
AVF disabled variants of the virt APEX. However, on the devices that do
not support AVF (i.e. using AVF disabled virt APEX), the
VirtualizationSystemService won't be started, since the AVF disabled
virt APEX won't have the `<apex-system-service>` entry in it's
AndroidManifest.xml
The change is guarded by the RELEASE_AVF_ENABLE_LLPVM_CHANGES build
flag.
Bug: 323339759
Test: boot device & check logs
Change-Id: I948be5eb38a9911d510f63e4976c117ccdb291f8
diff --git a/javalib/service/Android.bp b/javalib/service/Android.bp
new file mode 100644
index 0000000..9c1fa01
--- /dev/null
+++ b/javalib/service/Android.bp
@@ -0,0 +1,30 @@
+// Copyright (C) 2024 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+java_library {
+ name: "service-virtualization",
+ srcs: [
+ "src/**/*.java",
+ ],
+ defaults: [
+ "framework-system-server-module-defaults",
+ ],
+ sdk_version: "system_server_current",
+ apex_available: ["com.android.virt"],
+ installable: true,
+}
diff --git a/javalib/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java b/javalib/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java
new file mode 100644
index 0000000..2905acd
--- /dev/null
+++ b/javalib/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2024 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.system.virtualmachine;
+
+import android.content.Context;
+import com.android.server.SystemService;
+
+/** TODO */
+public class VirtualizationSystemService extends SystemService {
+
+ public VirtualizationSystemService(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void onStart() {}
+}