Initialize compsvc with allowlisted system properties
Bug: 231579544
Test: composd_cmd test-compile, see properties in the VM
Change-Id: Ia8b37236bb7039434d464be924aca5ee4c6bd42f
diff --git a/compos/composd/src/odrefresh_task.rs b/compos/composd/src/odrefresh_task.rs
index e06e5fe..51e866f 100644
--- a/compos/composd/src/odrefresh_task.rs
+++ b/compos/composd/src/odrefresh_task.rs
@@ -27,7 +27,9 @@
use compos_aidl_interface::aidl::com::android::compos::ICompOsService::{
CompilationMode::CompilationMode, ICompOsService,
};
-use compos_common::odrefresh::{ExitCode, ODREFRESH_OUTPUT_ROOT_DIR};
+use compos_common::odrefresh::{
+ is_system_property_interesting, ExitCode, ODREFRESH_OUTPUT_ROOT_DIR,
+};
use log::{error, info, warn};
use rustutils::system_properties;
use std::fs::{remove_dir_all, File, OpenOptions};
@@ -124,6 +126,16 @@
compilation_mode: CompilationMode,
target_dir_name: &str,
) -> Result<ExitCode> {
+ let mut names = Vec::new();
+ let mut values = Vec::new();
+ system_properties::foreach(|name, value| {
+ if is_system_property_interesting(name) {
+ names.push(name.to_owned());
+ values.push(value.to_owned());
+ }
+ })?;
+ service.initializeSystemProperties(&names, &values).context("initialize system properties")?;
+
let output_root = Path::new(ODREFRESH_OUTPUT_ROOT_DIR);
// We need to remove the target directory because odrefresh running in compos will create it