Add API getting list of assignable devices
An app can call getAssignableDevices to check the types of devices
supported. The app must have USE_CUSTOM_VIRTUAL_MACHINE permission
to do that.
Bug: 287379025
Test: TH
Change-Id: I2013810388eaf7599ac1e2e6e535be0aca0cbec7
diff --git a/virtualizationmanager/src/aidl.rs b/virtualizationmanager/src/aidl.rs
index b2497b1..daee7c5 100644
--- a/virtualizationmanager/src/aidl.rs
+++ b/virtualizationmanager/src/aidl.rs
@@ -28,6 +28,7 @@
ErrorCode::ErrorCode,
};
use android_system_virtualizationservice::aidl::android::system::virtualizationservice::{
+ AssignableDevice::AssignableDevice,
CpuTopology::CpuTopology,
DiskImage::DiskImage,
IVirtualMachine::{BnVirtualMachine, IVirtualMachine},
@@ -270,6 +271,12 @@
// Delegate to the global service, including checking the debug permission.
GLOBAL_SERVICE.debugListVms()
}
+
+ /// Get a list of assignable device types.
+ fn getAssignableDevices(&self) -> binder::Result<Vec<AssignableDevice>> {
+ // Delegate to the global service, including checking the permission.
+ GLOBAL_SERVICE.getAssignableDevices()
+ }
}
impl VirtualizationService {
@@ -1236,7 +1243,7 @@
return Err(Status::new_service_specific_error_str(
-1,
Some(format!("cannot find a VM with CID {}", cid)),
- ))
+ ));
};
let instance_img_path = vm.temporary_directory.join("rkpvm_instance.img");
let instance_img = OpenOptions::new()