Ignore debug policy with sysprop
Read system property hypervisor.virtualizationmanager.debug_policy.path
to decide whether to ignore debug policy or not.
Follow-up CLs will use the system property to disable debug policy for
tests and also allows to set custom debug policy for debug policy test.
Bug: 272496125, Bug: 275047565
Test: Run following tests twice with/without the sysprop \
1) `atest MicrodroidTestApp MicrodroidHostTestCases` for \
checking no regression. \
2) Launched VM on a debug policy enabled device without debug level
Change-Id: I9f3a829c84a55441942953979e3aec893c0405fd
diff --git a/virtualizationmanager/src/crosvm.rs b/virtualizationmanager/src/crosvm.rs
index 8497564..a8cad94 100644
--- a/virtualizationmanager/src/crosvm.rs
+++ b/virtualizationmanager/src/crosvm.rs
@@ -16,7 +16,7 @@
use crate::aidl::{remove_temporary_files, Cid, VirtualMachineCallbacks};
use crate::atom::{get_num_cpus, write_vm_exited_stats};
-use crate::debug_config::should_prepare_console_output;
+use crate::debug_config::DebugConfig;
use anyhow::{anyhow, bail, Context, Error, Result};
use command_fds::CommandFdExt;
use lazy_static::lazy_static;
@@ -102,7 +102,7 @@
pub disks: Vec<DiskFile>,
pub params: Option<String>,
pub protected: bool,
- pub debug_level: DebugLevel,
+ pub debug_config: DebugConfig,
pub memory_mib: Option<NonZeroU32>,
pub cpus: Option<NonZeroU32>,
pub host_cpu_topology: bool,
@@ -735,7 +735,9 @@
} else if config.ramdump.is_some() {
command.arg("--params").arg(format!("crashkernel={RAMDUMP_RESERVED_MIB}M"));
}
- if config.debug_level == DebugLevel::NONE && should_prepare_console_output(config.debug_level) {
+ if config.debug_config.debug_level == DebugLevel::NONE
+ && config.debug_config.should_prepare_console_output()
+ {
// bootconfig.normal will be used, but we need log.
command.arg("--params").arg("printk.devkmsg=on");
command.arg("--params").arg("console=hvc0");