diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-06-06 23:47:10 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-06-06 23:47:10 +0000 |
commit | 33ef503e865d634a10f4a788f9713160141f6dd4 (patch) | |
tree | 0a4d286e98ca1efd883636473129406214d4785e | |
parent | acbb6b7bbea17c5653929ee5224bd4f8e16c0f69 (diff) | |
parent | 8cc2bb61280c5ee79edc866e2726fb999b7a5aa5 (diff) | |
download | netd-33ef503e865d634a10f4a788f9713160141f6dd4.tar.gz |
Merge "Only Log Netlink Messages on Eng Builds" into pi-devandroid-vts-9.0_r9android-vts-9.0_r8android-vts-9.0_r7android-vts-9.0_r6android-vts-9.0_r5android-vts-9.0_r4android-vts-9.0_r10pie-dev
-rw-r--r-- | server/XfrmController.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/server/XfrmController.cpp b/server/XfrmController.cpp index 8a891eb7..b9a5a415 100644 --- a/server/XfrmController.cpp +++ b/server/XfrmController.cpp @@ -44,11 +44,6 @@ #include <linux/xfrm.h> #define LOG_TAG "XfrmController" -#include "android-base/stringprintf.h" -#include "android-base/strings.h" -#include "android-base/unique_fd.h" -#include <android/net/INetd.h> -#include <log/log_properties.h> #include "InterfaceController.h" #include "NetdConstants.h" #include "NetlinkCommands.h" @@ -57,6 +52,11 @@ #include "netdutils/Fd.h" #include "netdutils/Slice.h" #include "netdutils/Syscalls.h" +#include <android-base/properties.h> +#include <android-base/stringprintf.h> +#include <android-base/strings.h> +#include <android-base/unique_fd.h> +#include <android/net/INetd.h> #include <cutils/log.h> #include <cutils/properties.h> #include <logwrap/logwrap.h> @@ -87,6 +87,11 @@ constexpr uint32_t RAND_SPI_MAX = 0xFFFFFFFE; constexpr uint32_t INVALID_SPI = 0; +static inline bool isEngBuild() { + static const std::string sBuildType = android::base::GetProperty("ro.build.type", "user"); + return sBuildType == "eng"; +} + #define XFRM_MSG_TRANS(x) \ case x: \ return #x; @@ -126,18 +131,18 @@ uint8_t kPadBytesArray[] = {0, 0, 0}; void* kPadBytes = static_cast<void*>(kPadBytesArray); #define LOG_HEX(__desc16__, __buf__, __len__) \ - if (__android_log_is_debuggable()) { \ - do { \ + do { \ + if (isEngBuild()) { \ logHex(__desc16__, __buf__, __len__); \ - } while (0); \ - } + } \ + } while (0) #define LOG_IOV(__iov__) \ - if (__android_log_is_debuggable()) { \ - do { \ + do { \ + if (isEngBuild()) { \ logIov(__iov__); \ - } while (0); \ - } + } \ + } while (0) void logHex(const char* desc16, const char* buf, size_t len) { char* printBuf = new char[len * 2 + 1 + 26]; // len->ascii, +newline, +prefix strlen |