adb: call android::base::InitLogging even when adb tracing is disabled
This is a follow-up to https://android-review.googlesource.com/153623
which prevented android::base::InitLogging() from being called when
tracing was disabled.
It is ok to call InitLogging() on a device or host because calling it
does not imply that a logging file is used, which was the reason for
not calling it on a device.
So this change should preserve the device behavior of not using a
logging file when tracing is disabled, plus it will call InitLogging()
all the time in case logging APIs are called.
Change-Id: I3fd6ba2c567f67a2f111a85f174893fbf866ec57
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
diff --git a/adb.cpp b/adb.cpp
index 821b785..fc7320c 100644
--- a/adb.cpp
+++ b/adb.cpp
@@ -192,16 +192,13 @@
}
void adb_trace_init(char** argv) {
+#if !ADB_HOST
// Don't open log file if no tracing, since this will block
// the crypto unmount of /data
- const std::string trace_setting = get_trace_setting();
- if (trace_setting.empty()) {
- return;
- }
-
-#if !ADB_HOST
- if (isatty(STDOUT_FILENO) == 0) {
- start_device_log();
+ if (!get_trace_setting().empty()) {
+ if (isatty(STDOUT_FILENO) == 0) {
+ start_device_log();
+ }
}
#endif