Skeleton for IVmTethering service with flag guarding
This reverts commit f9676878292a49caa03e5270c3be2769b029db60.
Bug: 340376953
Test: adb shell /apex/com.android.virt/bin/vm run-microdroid --network-supported
Change-Id: I9c859dd43e7ba7c852a71afce8f36ca10477ad24
diff --git a/java/jni/Android.bp b/java/jni/Android.bp
index 4a569d4..d9b1880 100644
--- a/java/jni/Android.bp
+++ b/java/jni/Android.bp
@@ -20,6 +20,20 @@
}
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
new file mode 100644
index 0000000..a15e7a7
--- /dev/null
+++ b/java/jni/com_android_system_virtualmachine_VirtualizationSystemService.cpp
@@ -0,0 +1,27 @@
+/*
+ * 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();
+}