odrefresh: explicitly initialize to use system logger
Bug: 201042799
Test: boot and observe logcat output
Change-Id: I20c76aae5a4c2d5e0f66e739302ff9307e9f15b8
diff --git a/odrefresh/odrefresh_main.cc b/odrefresh/odrefresh_main.cc
index 93ce5fb..d234e0d 100644
--- a/odrefresh/odrefresh_main.cc
+++ b/odrefresh/odrefresh_main.cc
@@ -134,7 +134,7 @@
return false;
}
-int InitializeHostConfig(int argc, const char** argv, OdrConfig* config) {
+int InitializeHostConfig(int argc, char** argv, OdrConfig* config) {
__android_log_set_logger(__android_log_stderr_logger);
std::string current_binary;
@@ -180,7 +180,7 @@
return n;
}
-int InitializeTargetConfig(int argc, const char** argv, OdrConfig* config) {
+int InitializeTargetConfig(int argc, char** argv, OdrConfig* config) {
config->SetApexInfoListFile("/apex/apex-info-list.xml");
config->SetArtBinDir(art::GetArtBinDir());
config->SetBootClasspath(GetEnvironmentVariableOrDie("BOOTCLASSPATH"));
@@ -208,7 +208,7 @@
return n;
}
-int InitializeConfig(int argc, const char** argv, OdrConfig* config) {
+int InitializeConfig(int argc, char** argv, OdrConfig* config) {
if (art::kIsTargetBuild) {
return InitializeTargetConfig(argc, argv, config);
} else {
@@ -218,12 +218,15 @@
} // namespace
-int main(int argc, const char** argv) {
+int main(int argc, char** argv) {
// odrefresh is launched by `init` which sets the umask of forked processed to
// 077 (S_IRWXG | S_IRWXO). This blocks the ability to make files and directories readable
// by others and prevents system_server from loading generated artifacts.
umask(S_IWGRP | S_IWOTH);
+ // Explicitly initialize logging (b/201042799).
+ android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM));
+
OdrConfig config(argv[0]);
int n = InitializeConfig(argc, argv, &config);
argv += n;