OSDN Git Service

BTIF: Add meaningful logging to btif_profile_queue
authorJack He <siyuanh@google.com>
Wed, 30 Aug 2017 18:13:08 +0000 (11:13 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 1 Sep 2017 18:04:25 +0000 (18:04 +0000)
* Add INFO logging to add/advance/execute functions in
  btif_profile_queue
* Add ERROR logging to add failures

Bug: 65051171
Test: Try connection to multiple profiles
Change-Id: I058ad06a45eeceb4d160af472f317d08843ca6bf
(cherry picked from commit f42cf2b48f4c73fa2e6e6511b20d98a9ab665a7e)

btif/src/btif_profile_queue.cc

index 4d2efef..591178f 100644 (file)
@@ -77,20 +77,32 @@ static void queue_int_add(connect_node_t* p_param) {
   for (const list_node_t* node = list_begin(connect_queue);
        node != list_end(connect_queue); node = list_next(node)) {
     if (((connect_node_t*)list_node(node))->uuid == p_param->uuid) {
-      LOG_INFO(LOG_TAG, "%s dropping duplicate connect request for uuid: %04x",
-               __func__, p_param->uuid);
+      LOG_ERROR(LOG_TAG,
+                "%s dropping duplicate connection request UUID=%04X, "
+                "bd_addr=%s, busy=%d",
+                __func__, p_param->uuid, p_param->bda.ToString().c_str(),
+                p_param->busy);
       return;
     }
   }
 
+  LOG_INFO(
+      LOG_TAG, "%s: adding connection request UUID=%04X, bd_addr=%s, busy=%d",
+      __func__, p_param->uuid, p_param->bda.ToString().c_str(), p_param->busy);
   connect_node_t* p_node = (connect_node_t*)osi_malloc(sizeof(connect_node_t));
   memcpy(p_node, p_param, sizeof(connect_node_t));
   list_append(connect_queue, p_node);
 }
 
 static void queue_int_advance() {
-  if (connect_queue && !list_is_empty(connect_queue))
-    list_remove(connect_queue, list_front(connect_queue));
+  if (connect_queue && !list_is_empty(connect_queue)) {
+    connect_node_t* p_head = (connect_node_t*)list_front(connect_queue);
+    LOG_INFO(LOG_TAG,
+             "%s: removing connection request UUID=%04X, bd_addr=%s, busy=%d",
+             __func__, p_head->uuid, p_head->bda.ToString().c_str(),
+             p_head->busy);
+    list_remove(connect_queue, p_head);
+  }
 }
 
 static void queue_int_handle_evt(uint16_t event, char* p_param) {
@@ -152,6 +164,10 @@ bt_status_t btif_queue_connect_next(void) {
 
   connect_node_t* p_head = (connect_node_t*)list_front(connect_queue);
 
+  LOG_INFO(LOG_TAG,
+           "%s: executing connection request UUID=%04X, bd_addr=%s, busy=%d",
+           __func__, p_head->uuid, p_head->bda.ToString().c_str(),
+           p_head->busy);
   // If the queue is currently busy, we return success anyway,
   // since the connection has been queued...
   if (p_head->busy) return BT_STATUS_SUCCESS;