Always log to logcat
After commit 611cc94626825840661ab20f84b3903c48331dec we always pass
the log_to_stderr flag when running compsvc. So we can remove the flag.
Switched to logcat so all logs end up in the same place.
Added one extra log line in composd so it's easy to tell we succeeded
without needing to see the VM logs.
Bug: 213891964
Test: atest ComposTestCase
Test: composd_cmd test-compile, check logs
Test: composd_cmd staged-apex-compile, check logs
Change-Id: I076d06a752dbf5f13abfe971b2f7aa80a67c9a20
diff --git a/compos/apk/assets/vm_config.json b/compos/apk/assets/vm_config.json
index 260332e..b93c3f7 100644
--- a/compos/apk/assets/vm_config.json
+++ b/compos/apk/assets/vm_config.json
@@ -5,10 +5,7 @@
},
"task": {
"type": "executable",
- "command": "/apex/com.android.compos/bin/compsvc",
- "args": [
- "--log_to_stderr"
- ]
+ "command": "/apex/com.android.compos/bin/compsvc"
},
"extra_apks": [
{
diff --git a/compos/apk/assets/vm_config_staged.json b/compos/apk/assets/vm_config_staged.json
index 1affa79..83fa6eb 100644
--- a/compos/apk/assets/vm_config_staged.json
+++ b/compos/apk/assets/vm_config_staged.json
@@ -5,10 +5,7 @@
},
"task": {
"type": "executable",
- "command": "/apex/com.android.compos/bin/compsvc",
- "args": [
- "--log_to_stderr"
- ]
+ "command": "/apex/com.android.compos/bin/compsvc"
},
"prefer_staged": true,
"extra_apks": [
diff --git a/compos/composd/src/odrefresh_task.rs b/compos/composd/src/odrefresh_task.rs
index 47ff590..82eedc4 100644
--- a/compos/composd/src/odrefresh_task.rs
+++ b/compos/composd/src/odrefresh_task.rs
@@ -27,7 +27,7 @@
CompilationMode::CompilationMode, ICompOsService,
};
use compos_common::odrefresh::ExitCode;
-use log::{error, warn};
+use log::{error, info, warn};
use rustutils::system_properties;
use std::fs::{remove_dir_all, File, OpenOptions};
use std::os::unix::fs::OpenOptionsExt;
@@ -96,7 +96,10 @@
// We don't do the callback if cancel has already happened.
if let Some(task) = task {
let result = match exit_code {
- Ok(ExitCode::CompilationSuccess) => task.callback.onSuccess(),
+ Ok(ExitCode::CompilationSuccess) => {
+ info!("CompilationSuccess");
+ task.callback.onSuccess()
+ }
Ok(exit_code) => {
error!("Unexpected odrefresh result: {:?}", exit_code);
task.callback.onFailure()
diff --git a/compos/src/compsvc_main.rs b/compos/src/compsvc_main.rs
index ebb5514..16e3031 100644
--- a/compos/src/compsvc_main.rs
+++ b/compos/src/compsvc_main.rs
@@ -51,20 +51,13 @@
}
fn try_main() -> Result<()> {
- let args = clap::App::new("compsvc")
- .arg(clap::Arg::with_name("log_to_stderr").long("log_to_stderr"))
- .get_matches();
- if args.is_present("log_to_stderr") {
- env_logger::builder().filter_level(log::LevelFilter::Debug).init();
- } else {
- android_logger::init_once(
- android_logger::Config::default().with_tag("compsvc").with_min_level(log::Level::Debug),
- );
- // Redirect panic messages to logcat.
- panic::set_hook(Box::new(|panic_info| {
- log::error!("{}", panic_info);
- }));
- }
+ android_logger::init_once(
+ android_logger::Config::default().with_tag("compsvc").with_min_level(log::Level::Debug),
+ );
+ // Redirect panic messages to logcat.
+ panic::set_hook(Box::new(|panic_info| {
+ error!("{}", panic_info);
+ }));
let service = compsvc::new_binder()?.as_binder();
let vm_service = get_vm_service()?;