1# Demo for serving a service in a VM 2 3You can implement a service in a VM, and let client in the Android can use it 4as if it's in the Android. To do so, use libbinder's IAccessor. 5 6IAccessor allows AIDL service in a VM to be accessed via servicemanager. 7To do so, VM owners should also provide IAccessor through libbinder's service 8manager APIs. servicemanager will connect to the IAccessor and get the binder 9of the service in a VM with it. 10 11com.android.virt.accessor_demo apex contains the minimum setup for IAccessor as 12follows: 13 - accessor_demo: Sample implementation using IAccessor, which is expected to 14 launch VM and returns the Vsock connection of service in the VM. 15 - AccessorVmApp: Sample app that conatins VM payload. Provides the actual 16 implementation of service in a VM. 17 18## Build 19 20You need to do envsetup.sh 21```shell 22m com.android.virt.accessor_demo 23``` 24 25## Install (requires userdebug build) 26 27For very first install, 28 29```shell 30adb remount -R || adb wait-for-device # Remount to push apex to /system_ext 31adb root && adb remount # Ensure it's rebooted. 32adb push $ANDROID_PRODUCT_OUT/system_ext/apex/com.android.virt.accessor_demo.apex /system_ext/apex 33adb reboot && adb wait-for-device # Ensure that newly pushed apex at /system_ext is installed 34``` 35 36Once it's installed, you can simply use `adb install` for update. 37 38```shell 39adb install $ANDROID_PRODUCT_OUT/system_ext/com.android.virt.accessor_demo.apex 40adb reboot 41``` 42