disable debug logs in production builds in native - restricted debug logs only for debug/eng builds Bug: 323279158 Test: Verified in user and userdebug binaries Change-Id: I93b4ff41c564236001648abc7c3dfb07d6ae2424
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp index 524132c..ff0f8c6 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp
@@ -15,9 +15,9 @@ */ #include <ImsMediaTrace.h> +#include <log/log_properties.h> #include <string.h> #include <utils/Log.h> -#include <sys/time.h> #ifdef IM_FILE_LOG #include <stdio.h> @@ -66,12 +66,14 @@ } while (0) #endif +#define IM_IS_DEBUGGABLE() (gLogMode <= kLogEnableDebug && __android_log_is_debuggable()) + static uint gLogMode = kLogEnableDebug; static uint gDebugLogMode = 0; void ImsMediaTrace::IMLOGD_PACKET_ARG(IM_PACKET_LOG_TYPE type, const char* format, ...) { - if (gDebugLogMode & type && gLogMode <= kLogEnableDebug) + if (gDebugLogMode & type && IM_IS_DEBUGGABLE()) { __IMLOG__(ANDROID_LOG_DEBUG, IM_DEBUG_TAG); } @@ -94,7 +96,7 @@ void ImsMediaTrace::IMLOGD_ARG(const char* format, ...) { - if (gLogMode <= kLogEnableDebug) + if (IM_IS_DEBUGGABLE()) { __IMLOG__(ANDROID_LOG_DEBUG, IM_TAG); }