Loading adb/Android.mk +8 −4 Original line number Diff line number Diff line Loading @@ -77,6 +77,10 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES := libbase # Even though we're building a static library (and thus there's no link step for # this to take effect), this adds the includes to our path. LOCAL_STATIC_LIBRARIES := libbase include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) Loading @@ -91,8 +95,8 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES := libbase # Even though we're building a static library (and thus there's no link step for # this to take effect), this adds the SSL includes to our path. LOCAL_STATIC_LIBRARIES := libcrypto_static # this to take effect), this adds the includes to our path. LOCAL_STATIC_LIBRARIES := libcrypto_static libbase ifeq ($(HOST_OS),windows) LOCAL_C_INCLUDES += development/host/windows/usb/api/ Loading Loading @@ -254,10 +258,10 @@ LOCAL_STATIC_LIBRARIES := \ libbase \ libfs_mgr \ liblog \ libcutils \ libc \ libmincrypt \ libselinux \ libext4_utils_static \ libcutils \ libbase \ include $(BUILD_EXECUTABLE) adb/adb.cpp +33 −51 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ #include <time.h> #include <string> #include <vector> #include <unordered_map> #include <base/stringprintf.h> #include <base/strings.h> Loading Loading @@ -130,19 +132,16 @@ std::string get_trace_setting() { #endif } // Split the comma/space/colum/semi-column separated list of tags from the trace // setting and build the trace mask from it. note that '1' and 'all' are special // cases to enable all tracing. // Split the space separated list of tags from the trace setting and build the // trace mask from it. note that '1' and 'all' are special cases to enable all // tracing. // // adb's trace setting comes from the ADB_TRACE environment variable, whereas // adbd's comes from the system property persist.adb.trace_mask. void adb_trace_init() { const std::string trace_setting = get_trace_setting(); static const struct { const char* tag; int flag; } tags[] = { std::unordered_map<std::string, int> trace_flags = { {"1", 0}, {"all", 0}, {"adb", TRACE_ADB}, Loading @@ -155,41 +154,24 @@ void adb_trace_init() { {"transport", TRACE_TRANSPORT}, {"jdwp", TRACE_JDWP}, {"services", TRACE_SERVICES}, { "auth", TRACE_AUTH }, { NULL, 0 } }; if (trace_setting.empty()) { return; } // Use a comma/colon/semi-colon/space separated list const char* p = trace_setting.c_str(); while (*p) { int len, tagn; {"auth", TRACE_AUTH}}; const char* q = strpbrk(p, " ,:;"); if (q == NULL) { q = p + strlen(p); std::vector<std::string> elements = android::base::Split(trace_setting, " "); for (const auto& elem : elements) { const auto& flag = trace_flags.find(elem); if (flag == trace_flags.end()) { D("Unknown trace flag: %s", flag->first.c_str()); continue; } len = q - p; for (tagn = 0; tags[tagn].tag != NULL; tagn++) { int taglen = strlen(tags[tagn].tag); if (len == taglen && !memcmp(tags[tagn].tag, p, len)) { int flag = tags[tagn].flag; if (flag == 0) { if (flag->second == 0) { // 0 is used for the special values "1" and "all" that enable all // tracing. adb_trace_mask = ~0; return; } else { adb_trace_mask |= 1 << flag->second; } adb_trace_mask |= (1 << flag); break; } } p = q; if (*p) p++; } #if !ADB_HOST Loading Loading
adb/Android.mk +8 −4 Original line number Diff line number Diff line Loading @@ -77,6 +77,10 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES := libbase # Even though we're building a static library (and thus there's no link step for # this to take effect), this adds the includes to our path. LOCAL_STATIC_LIBRARIES := libbase include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) Loading @@ -91,8 +95,8 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES := libbase # Even though we're building a static library (and thus there's no link step for # this to take effect), this adds the SSL includes to our path. LOCAL_STATIC_LIBRARIES := libcrypto_static # this to take effect), this adds the includes to our path. LOCAL_STATIC_LIBRARIES := libcrypto_static libbase ifeq ($(HOST_OS),windows) LOCAL_C_INCLUDES += development/host/windows/usb/api/ Loading Loading @@ -254,10 +258,10 @@ LOCAL_STATIC_LIBRARIES := \ libbase \ libfs_mgr \ liblog \ libcutils \ libc \ libmincrypt \ libselinux \ libext4_utils_static \ libcutils \ libbase \ include $(BUILD_EXECUTABLE)
adb/adb.cpp +33 −51 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ #include <time.h> #include <string> #include <vector> #include <unordered_map> #include <base/stringprintf.h> #include <base/strings.h> Loading Loading @@ -130,19 +132,16 @@ std::string get_trace_setting() { #endif } // Split the comma/space/colum/semi-column separated list of tags from the trace // setting and build the trace mask from it. note that '1' and 'all' are special // cases to enable all tracing. // Split the space separated list of tags from the trace setting and build the // trace mask from it. note that '1' and 'all' are special cases to enable all // tracing. // // adb's trace setting comes from the ADB_TRACE environment variable, whereas // adbd's comes from the system property persist.adb.trace_mask. void adb_trace_init() { const std::string trace_setting = get_trace_setting(); static const struct { const char* tag; int flag; } tags[] = { std::unordered_map<std::string, int> trace_flags = { {"1", 0}, {"all", 0}, {"adb", TRACE_ADB}, Loading @@ -155,41 +154,24 @@ void adb_trace_init() { {"transport", TRACE_TRANSPORT}, {"jdwp", TRACE_JDWP}, {"services", TRACE_SERVICES}, { "auth", TRACE_AUTH }, { NULL, 0 } }; if (trace_setting.empty()) { return; } // Use a comma/colon/semi-colon/space separated list const char* p = trace_setting.c_str(); while (*p) { int len, tagn; {"auth", TRACE_AUTH}}; const char* q = strpbrk(p, " ,:;"); if (q == NULL) { q = p + strlen(p); std::vector<std::string> elements = android::base::Split(trace_setting, " "); for (const auto& elem : elements) { const auto& flag = trace_flags.find(elem); if (flag == trace_flags.end()) { D("Unknown trace flag: %s", flag->first.c_str()); continue; } len = q - p; for (tagn = 0; tags[tagn].tag != NULL; tagn++) { int taglen = strlen(tags[tagn].tag); if (len == taglen && !memcmp(tags[tagn].tag, p, len)) { int flag = tags[tagn].flag; if (flag == 0) { if (flag->second == 0) { // 0 is used for the special values "1" and "all" that enable all // tracing. adb_trace_mask = ~0; return; } else { adb_trace_mask |= 1 << flag->second; } adb_trace_mask |= (1 << flag); break; } } p = q; if (*p) p++; } #if !ADB_HOST Loading