OSDN Git Service

Re-log btif/src/btif_hf::HeadsetInterface::PhoneStateChange
authorChris Manton <cmanton@google.com>
Sat, 26 Dec 2020 23:04:45 +0000 (15:04 -0800)
committerChris Manton <cmanton@google.com>
Mon, 4 Jan 2021 18:24:13 +0000 (10:24 -0800)
Towards loggable code

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

Change-Id: I15eaff0ca87530a27c4ac52d85c1e38aa87fb4e0

btif/src/btif_hf.cc

index 2fb7ac7..cb0fa89 100644 (file)
@@ -45,6 +45,7 @@
 #include "btif_profile_queue.h"
 #include "btif_util.h"
 #include "common/metrics.h"
+#include "main/shim/dumpsys.h"
 
 namespace bluetooth {
 namespace headset {
@@ -1079,13 +1080,13 @@ bt_status_t HeadsetInterface::PhoneStateChange(
     RawAddress* bd_addr) {
   CHECK_BTHF_INIT();
   if (!bd_addr) {
-    BTIF_TRACE_WARNING("%s: bd_addr is null", __func__);
+    LOG_WARN("bd_addr is null");
     return BT_STATUS_FAIL;
   }
+  const RawAddress raw_address(*bd_addr);
   int idx = btif_hf_idx_by_bdaddr(bd_addr);
   if (idx < 0 || idx > BTA_AG_MAX_NUM_CLIENTS) {
-    BTIF_TRACE_WARNING("%s: invalid index %d for %s", __func__, idx,
-                       bd_addr->ToString().c_str());
+    LOG_WARN("Invalid index %d for %s", idx, PRIVATE_ADDRESS(raw_address));
     return BT_STATUS_FAIL;
   }
   const btif_hf_cb_t& control_block = btif_hf_cb[idx];