OSDN Git Service

Add privatize option for bluetooth addresses for logging
authorChris Manton <cmanton@google.com>
Mon, 30 Nov 2020 01:05:05 +0000 (17:05 -0800)
committerChris Manton <cmanton@google.com>
Wed, 2 Dec 2020 01:11:31 +0000 (01:11 +0000)
Toward loggable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: Id568adb9f9497072a79100202501c4d207e40828

main/shim/dumpsys.h

index 363c5c8..39e61e4 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <functional>
 #include <list>
+#include <string>
 
 #define LOG_DUMPSYS(fd, fmt, args...)                 \
   do {                                                \
 
 #define BOOL_TEXT(b) ((b) ? "true" : "false")
 
+constexpr char kPrivateAddressPrefix[] = "xx:xx:xx:xx";
+#define PRIVATE_ADDRESS(addr)                                            \
+  (addr.ToString()                                                       \
+       .replace(0, strlen(kPrivateAddressPrefix), kPrivateAddressPrefix) \
+       .c_str())
+
 namespace bluetooth {
 namespace shim {