Update to improved system_properties API.
We'll now return an error if there is an actual error reading the
property, rather than treating it the same as the property not being
set.
Bug: 217728265
Test: mm
Change-Id: I81f22d9ed07443b094f9a64a0737f4d24a2afe15
diff --git a/compos/composd/src/instance_manager.rs b/compos/composd/src/instance_manager.rs
index 2f15cb5..9761a3e 100644
--- a/compos/composd/src/instance_manager.rs
+++ b/compos/composd/src/instance_manager.rs
@@ -83,15 +83,15 @@
}
fn new_vm_parameters() -> Result<VmParameters> {
- let cpus = match system_properties::read(DEX2OAT_THREADS_PROP_NAME) {
- Ok(s) => Some(NonZeroU32::from_str(&s)?),
- Err(_) => {
+ let cpus = match system_properties::read(DEX2OAT_THREADS_PROP_NAME)? {
+ Some(s) => Some(NonZeroU32::from_str(&s)?),
+ None => {
// dex2oat uses all CPUs by default. To match the behavior, give the VM all CPUs by
// default.
NonZeroU32::new(num_cpus::get() as u32)
}
};
- let cpu_set = system_properties::read(DEX2OAT_CPU_SET_PROP_NAME).ok();
+ let cpu_set = system_properties::read(DEX2OAT_CPU_SET_PROP_NAME)?;
Ok(VmParameters { cpus, cpu_set, ..Default::default() })
}