Loading DnsResolver.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ bool resolv_init(const ResolverNetdCallbacks* callbacks) { android::base::InitLogging(/*argv=*/nullptr); LOG(INFO) << __func__ << ": Initializing resolver"; const bool isDebug = isUserDebugBuild(); const bool isDebug = isDebuggable(); resolv_set_log_severity(isDebug ? android::base::INFO : android::base::WARNING); doh_init_logger(isDebug ? DOH_LOG_LEVEL_INFO : DOH_LOG_LEVEL_WARN); using android::net::gApiLevel; Loading tests/dnsresolver_binder_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -621,9 +621,9 @@ TEST_F(DnsResolverBinderTest, setLogSeverity) { EXPECT_TRUE(mDnsResolver->setLogSeverity(IDnsResolver::DNS_RESOLVER_LOG_ERROR).isOk()); mExpectedLogData.push_back({"setLogSeverity(4)", "setLogSeverity.*4"}); // Set back to default based off resolv_init(), the default is INFO for userdebug builds // Set back to default based off resolv_init(), the default is INFO for userdebug/eng builds // and is WARNING for the other builds. if (isUserDebugBuild()) { if (isDebuggable()) { EXPECT_TRUE(mDnsResolver->setLogSeverity(IDnsResolver::DNS_RESOLVER_LOG_INFO).isOk()); mExpectedLogData.push_back({"setLogSeverity(2)", "setLogSeverity.*2"}); } else { Loading util.h +4 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,10 @@ inline uint64_t getApiLevel() { } // It's the identical strategy as frameworks/base/core/java/android/os/Build.java did. inline bool isUserDebugBuild() { return (android::base::GetProperty("ro.build.type", "user") == "userdebug"); // There's also equivalent C++ code in system/core/init/property_service.cpp // (and it is CTS tested in BuildTest.java) inline bool isDebuggable() { return android::base::GetBoolProperty("ro.debuggable", false); } inline bool isDoHEnabled() { Loading Loading
DnsResolver.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ bool resolv_init(const ResolverNetdCallbacks* callbacks) { android::base::InitLogging(/*argv=*/nullptr); LOG(INFO) << __func__ << ": Initializing resolver"; const bool isDebug = isUserDebugBuild(); const bool isDebug = isDebuggable(); resolv_set_log_severity(isDebug ? android::base::INFO : android::base::WARNING); doh_init_logger(isDebug ? DOH_LOG_LEVEL_INFO : DOH_LOG_LEVEL_WARN); using android::net::gApiLevel; Loading
tests/dnsresolver_binder_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -621,9 +621,9 @@ TEST_F(DnsResolverBinderTest, setLogSeverity) { EXPECT_TRUE(mDnsResolver->setLogSeverity(IDnsResolver::DNS_RESOLVER_LOG_ERROR).isOk()); mExpectedLogData.push_back({"setLogSeverity(4)", "setLogSeverity.*4"}); // Set back to default based off resolv_init(), the default is INFO for userdebug builds // Set back to default based off resolv_init(), the default is INFO for userdebug/eng builds // and is WARNING for the other builds. if (isUserDebugBuild()) { if (isDebuggable()) { EXPECT_TRUE(mDnsResolver->setLogSeverity(IDnsResolver::DNS_RESOLVER_LOG_INFO).isOk()); mExpectedLogData.push_back({"setLogSeverity(2)", "setLogSeverity.*2"}); } else { Loading
util.h +4 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,10 @@ inline uint64_t getApiLevel() { } // It's the identical strategy as frameworks/base/core/java/android/os/Build.java did. inline bool isUserDebugBuild() { return (android::base::GetProperty("ro.build.type", "user") == "userdebug"); // There's also equivalent C++ code in system/core/init/property_service.cpp // (and it is CTS tested in BuildTest.java) inline bool isDebuggable() { return android::base::GetBoolProperty("ro.debuggable", false); } inline bool isDoHEnabled() { Loading