Merge "Network build flag is delivered to VSS not relying on JNI" into main
diff --git a/Android.bp b/Android.bp
index b2af69e..3b6b8b5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -77,7 +77,6 @@
config_namespace: "ANDROID",
bool_variables: [
"release_avf_enable_dice_changes",
- "release_avf_enable_network",
"release_avf_enable_vendor_modules",
"release_avf_enable_virt_cpufreq",
],
@@ -92,9 +91,6 @@
release_avf_enable_dice_changes: {
cflags: ["-DAVF_OPEN_DICE_CHANGES=1"],
},
- release_avf_enable_network: {
- cflags: ["-DAVF_ENABLE_NETWORK=1"],
- },
release_avf_enable_vendor_modules: {
cflags: ["-DAVF_ENABLE_VENDOR_MODULES=1"],
},
diff --git a/apex/Android.bp b/apex/Android.bp
index 8a53a3d..17b1f9e 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -89,7 +89,6 @@
],
jni_libs: [
"libvirtualizationservice_jni",
- "libvirtualizationsystemservice_jni",
"libvirtualmachine_jni",
],
// TODO(b/295593640) Unfortunately these are added to the apex even though they are unused.
diff --git a/flags/cpp/include/android/avf_cc_flags.h b/flags/cpp/include/android/avf_cc_flags.h
index 70be925..c922266 100644
--- a/flags/cpp/include/android/avf_cc_flags.h
+++ b/flags/cpp/include/android/avf_cc_flags.h
@@ -27,14 +27,6 @@
#endif
}
-inline bool IsNetworkFlagEnabled() {
-#ifdef AVF_ENABLE_NETWORK
- return AVF_ENABLE_NETWORK;
-#else
- return false;
-#endif
-}
-
inline bool IsVendorModulesFlagEnabled() {
#ifdef AVF_ENABLE_VENDOR_MODULES
return AVF_ENABLE_VENDOR_MODULES;
diff --git a/java/jni/Android.bp b/java/jni/Android.bp
index d9b1880..4a569d4 100644
--- a/java/jni/Android.bp
+++ b/java/jni/Android.bp
@@ -20,20 +20,6 @@
}
cc_library_shared {
- name: "libvirtualizationsystemservice_jni",
- defaults: ["avf_build_flags_cc"],
- srcs: [
- "com_android_system_virtualmachine_VirtualizationSystemService.cpp",
- ],
- apex_available: ["com.android.virt"],
- shared_libs: [
- "liblog",
- "libnativehelper",
- ],
- static_libs: ["libavf_cc_flags"],
-}
-
-cc_library_shared {
name: "libvirtualmachine_jni",
defaults: ["avf_build_flags_cc"],
srcs: [
diff --git a/java/jni/com_android_system_virtualmachine_VirtualizationSystemService.cpp b/java/jni/com_android_system_virtualmachine_VirtualizationSystemService.cpp
deleted file mode 100644
index a15e7a7..0000000
--- a/java/jni/com_android_system_virtualmachine_VirtualizationSystemService.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 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.
- */
-
-#define LOG_TAG "VirtualizationSystemService"
-
-#include <android/avf_cc_flags.h>
-#include <jni.h>
-#include <log/log.h>
-
-extern "C" JNIEXPORT jboolean JNICALL
-Java_com_android_system_virtualmachine_VirtualizationSystemService_nativeIsNetworkFlagEnabled(
- [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) {
- return android::virtualization::IsNetworkFlagEnabled();
-}
diff --git a/java/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java b/java/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java
index f1d89d9..241eef4 100644
--- a/java/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java
+++ b/java/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java
@@ -35,6 +35,9 @@
import com.android.internal.os.BackgroundThread;
import com.android.server.SystemService;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
/**
* This class exists to notify virtualization service of relevant things happening in the Android
* framework.
@@ -43,24 +46,15 @@
* storing secrets for apps or users that no longer exist.
*/
public class VirtualizationSystemService extends SystemService {
- static {
- System.loadLibrary("virtualizationsystemservice_jni");
- }
-
private static final String TAG = VirtualizationSystemService.class.getName();
private static final String MAINTENANCE_SERVICE_NAME =
"android.system.virtualizationmaintenance";
private Handler mHandler;
private final TetheringService mTetheringService;
- /*
- * Retrieve boolean value whether RELEASE_AVF_ENABLE_NETWORK build flag is enabled or not.
- */
- static native boolean nativeIsNetworkFlagEnabled();
-
public VirtualizationSystemService(Context context) {
super(context);
- if (nativeIsNetworkFlagEnabled()) {
+ if (Files.exists(Paths.get("/apex/com.android.virt/bin/vmnic"))) {
mTetheringService = new TetheringService();
} else {
mTetheringService = null;