Merge "Use AtomicU64 for handle_ref_count"
diff --git a/compos/common/compos_client.rs b/compos/common/compos_client.rs
index 63a6fd6..072b90b 100644
--- a/compos/common/compos_client.rs
+++ b/compos/common/compos_client.rs
@@ -47,9 +47,6 @@
use std::sync::{Arc, Condvar, Mutex};
use std::thread;
-// Enough memory to complete odrefresh in the VM.
-const VM_MEMORY_MIB: i32 = 1024;
-
/// This owns an instance of the CompOS VM.
pub struct VmInstance {
#[allow(dead_code)] // Keeps the VM alive even if we don`t touch it
@@ -69,6 +66,8 @@
pub cpu_set: Option<String>,
/// If present, overrides the path to the VM config JSON file
pub config_path: Option<String>,
+ /// If present, overrides the amount of RAM to give the VM
+ pub memory_mib: Option<i32>,
}
impl VmInstance {
@@ -127,7 +126,7 @@
debugLevel: debug_level,
extraIdsigs: vec![idsig_manifest_apk_fd],
protectedVm: protected_vm,
- memoryMib: VM_MEMORY_MIB,
+ memoryMib: parameters.memory_mib.unwrap_or(0), // 0 means use the default
numCpus: parameters.cpus.map_or(1, NonZeroU32::get) as i32,
cpuAffinity: parameters.cpu_set.clone(),
});
diff --git a/compos/composd/src/instance_manager.rs b/compos/composd/src/instance_manager.rs
index f1289e8..587314c 100644
--- a/compos/composd/src/instance_manager.rs
+++ b/compos/composd/src/instance_manager.rs
@@ -32,6 +32,9 @@
use std::sync::{Arc, Mutex, Weak};
use virtualizationservice::IVirtualizationService::IVirtualizationService;
+// Enough memory to complete odrefresh in the VM.
+const VM_MEMORY_MIB: i32 = 1024;
+
pub struct InstanceManager {
service: Strong<dyn IVirtualizationService>,
state: Mutex<State>,
@@ -95,7 +98,7 @@
}
};
let cpu_set = system_properties::read(DEX2OAT_CPU_SET_PROP_NAME)?;
- Ok(VmParameters { cpus, cpu_set, ..Default::default() })
+ Ok(VmParameters { cpus, cpu_set, memory_mib: Some(VM_MEMORY_MIB), ..Default::default() })
}
// Ensures we only run one instance at a time.
diff --git a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
index ec8a3fb..8e86fd1 100644
--- a/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
+++ b/tests/hostside/helper/java/android/virt/test/VirtualizationTestCaseBase.java
@@ -102,7 +102,7 @@
public static void testIfDeviceIsCapable(ITestDevice androidDevice) throws Exception {
assumeTrue("Need an actual TestDevice", androidDevice instanceof TestDevice);
TestDevice testDevice = (TestDevice) androidDevice;
- assumeTrue("Requires VM support", testDevice.deviceSupportsMicrodroid());
+ assumeTrue("Requires VM support", testDevice.supportsMicrodroid());
}
// Run an arbitrary command in the host side and returns the result