Use generated sysprop library.
Bug: 270547306
Test: m libcompos_common libhypervisor_props
Change-Id: I55ce6689dabb5458979c497dfa6b9d71342dff89
diff --git a/libs/hypervisor_props/Android.bp b/libs/hypervisor_props/Android.bp
index af08b01..af6d417 100644
--- a/libs/hypervisor_props/Android.bp
+++ b/libs/hypervisor_props/Android.bp
@@ -9,7 +9,7 @@
edition: "2021",
rustlibs: [
"libanyhow",
- "librustutils",
+ "libplatformproperties_rust",
],
apex_available: [
"com.android.compos",
diff --git a/libs/hypervisor_props/src/lib.rs b/libs/hypervisor_props/src/lib.rs
index 120a48c..14614fd 100644
--- a/libs/hypervisor_props/src/lib.rs
+++ b/libs/hypervisor_props/src/lib.rs
@@ -14,18 +14,17 @@
//! Access to hypervisor capabilities via system properties set by the bootloader.
-use anyhow::{Error, Result};
-use rustutils::system_properties;
+use anyhow::Result;
+use platformproperties::hypervisorproperties;
/// Returns whether there is a hypervisor present that supports non-protected VMs.
pub fn is_vm_supported() -> Result<bool> {
- system_properties::read_bool("ro.boot.hypervisor.vm.supported", false).map_err(Error::new)
+ Ok(hypervisorproperties::hypervisor_vm_supported()?.unwrap_or(false))
}
/// Returns whether there is a hypervisor present that supports protected VMs.
pub fn is_protected_vm_supported() -> Result<bool> {
- system_properties::read_bool("ro.boot.hypervisor.protected_vm.supported", false)
- .map_err(Error::new)
+ Ok(hypervisorproperties::hypervisor_protected_vm_supported()?.unwrap_or(false))
}
/// Returns whether there is a hypervisor present that supports any sort of VM, either protected
@@ -36,5 +35,5 @@
/// Returns the version of the hypervisor, if there is one.
pub fn version() -> Result<Option<String>> {
- system_properties::read("ro.boot.hypervisor.version").map_err(Error::new)
+ Ok(hypervisorproperties::hypervisor_version()?)
}