From 7430916098fd264d569d398614d1d725adfca165 Mon Sep 17 00:00:00 2001 From: Spencer Low Date: Tue, 11 Aug 2015 15:48:15 -0700 Subject: [PATCH] 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 --- adb/adb.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/adb/adb.cpp b/adb/adb.cpp index 821b785df..fc7320ca3 100644 --- a/adb/adb.cpp +++ b/adb/adb.cpp @@ -192,16 +192,13 @@ static void setup_trace_mask() { } 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