Framework JNI uses libvmclient to connect to virtmgr
libvmclient, as its name shows, is a library designed as a client-side
library for AVF. It is responsible for spawning virtmgr and make a
connection to it.
However, the library wasn't used for the Java APIs. For those APIs, the
JNI part (libvirtualization_jni) implemented the almost identical
routine for spawning virtmgr.
This change de-duplicates the code in the JNI part by exposing an FFI
for libvmclient and let the JNI part use it.
Note that the JNI part had more checks at the end of the connection
establishment. That part is copied over to libvmclient.
Bug: N/A
Test: watch TH
Change-Id: Ib6b0f3a180a7dbd4c797188e98d4b0e66f76423b
diff --git a/libs/libvmclient/Android.bp b/libs/libvmclient/Android.bp
index 9fdeaf8..5bd59da 100644
--- a/libs/libvmclient/Android.bp
+++ b/libs/libvmclient/Android.bp
@@ -2,8 +2,8 @@
default_applicable_licenses: ["Android-Apache-2.0"],
}
-rust_library {
- name: "libvmclient",
+rust_defaults {
+ name: "libvmclient.default",
crate_name: "vmclient",
defaults: ["avf_build_flags_rust"],
srcs: ["src/lib.rs"],
@@ -25,3 +25,13 @@
"com.android.virt",
],
}
+
+rust_library {
+ name: "libvmclient",
+ defaults: ["libvmclient.default"],
+}
+
+rust_ffi_static {
+ name: "libvmclient.ffi",
+ defaults: ["libvmclient.default"],
+}