Use protected VM if possible
If the system is capable of running a protected VM, then request one.
On userdebug/eng builds only, fall back to unprotected VM if that is
all that is available. (This is useful for testing.)
A protected VM doesn't support full debug, so use app only debug in
that case. That change requires relaxing the constraint on running
compilation in test mode to match.
I've also increases the VM start timeout to avoid spurious timeouts.
Bug: 217687661
Test: composd_cmd staged-apex-compile
Test: composd_cmd test-compile
Change-Id: Ic7be2c5260982c3c69421c01d10c1537864b87be
diff --git a/compos/src/compilation.rs b/compos/src/compilation.rs
index 48ba4a6..ae4a29d 100644
--- a/compos/src/compilation.rs
+++ b/compos/src/compilation.rs
@@ -62,7 +62,9 @@
system_server_compiler_filter: &'a str,
) -> Result<Self> {
if compilation_mode != CompilationMode::NORMAL_COMPILE {
- let debuggable = system_properties::read_bool("ro.boot.microdroid.debuggable", false)?;
+ let debuggable = is_property_set("ro.boot.microdroid.debuggable")
+ || is_property_set("ro.boot.logd.enabled")
+ || is_property_set("ro.boot.adb.enabled");
if !debuggable {
bail!("Requested compilation mode only available in debuggable VMs");
}
@@ -97,6 +99,12 @@
}
}
+// Return whether the named property is definitely enabled. Deliberately conservative; returns
+// false if the property does not exist or cannot be read or is malformed.
+fn is_property_set(name: &str) -> bool {
+ system_properties::read_bool(name, false).unwrap_or(false)
+}
+
pub fn odrefresh(
odrefresh_path: &Path,
context: OdrefreshContext,