OSDN Git Service

Re-log stack/btm/btm_sec::btm_sec_connected
authorChris Manton <cmanton@google.com>
Thu, 4 Feb 2021 21:20:41 +0000 (13:20 -0800)
committerChris Manton <cmanton@google.com>
Fri, 12 Feb 2021 18:36:43 +0000 (10:36 -0800)
Towards loggable code

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

Change-Id: I41ea59a249acd33ec750b1955adc25139ece9528

stack/btm/btm_sec.cc

index 776bcf1..30b42ff 100644 (file)
@@ -3352,20 +3352,22 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle,
   }
 
   if (!p_dev_rec) {
-    LOG_DEBUG("Allocating new device record for new connection peer:%s",
-              PRIVATE_ADDRESS(bda));
     if (status == HCI_SUCCESS) {
       p_dev_rec = btm_sec_alloc_dev(bda);
+      LOG_DEBUG("Allocated new device record for new connection peer:%s",
+                PRIVATE_ADDRESS(bda));
     } else {
       /* If the device matches with stored paring address
        * reset the paring state to idle */
       if ((btm_cb.pairing_state != BTM_PAIR_STATE_IDLE) &&
           btm_cb.pairing_bda == bda) {
+        LOG_WARN("Connection failed during bonding attempt peer:%s reason:%s",
+                 PRIVATE_ADDRESS(bda), hci_error_code_text(status).c_str());
         btm_sec_change_pairing_state(BTM_PAIR_STATE_IDLE);
       }
 
-      /* can not find the device record and the status is error,
-       * just ignore it */
+      LOG_DEBUG("Ignoring failed device connection peer:%s reason:%s",
+                PRIVATE_ADDRESS(bda), hci_error_code_text(status).c_str());
       return;
     }
   } else /* Update the timestamp for this device */