OSDN Git Service

Revert "Open connection if it doesn't exsist in bta_gattc_process_indicate"
authorJakub Pawlowski <jpawlowski@google.com>
Tue, 11 Jun 2019 11:30:04 +0000 (11:30 +0000)
committerJakub Pawlowski <jpawlowski@google.com>
Tue, 11 Jun 2019 18:18:32 +0000 (18:18 +0000)
This reverts commit ffc95919835bbf89d635516955bff1b3b8a17641.

Reason for revert: breaks HA bonding from within app.

Bug: 134942525
Change-Id: I824391b1c84b535d7f251e176a5169eb79921c7f

bta/gatt/bta_gattc_act.cc

index 90978f6..5e60049 100644 (file)
@@ -1240,20 +1240,6 @@ void bta_gattc_process_indicate(uint16_t conn_id, tGATTC_OPTYPE op,
   }
 
   tBTA_GATTC_CLCB* p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
-  /* connection not open yet */
-  if (p_clcb == NULL) {
-    p_clcb = bta_gattc_clcb_alloc(gatt_if, remote_bda, transport);
-
-    if (p_clcb == NULL) {
-      LOG(ERROR) << __func__ << ": No resources";
-      return;
-    }
-
-    p_clcb->bta_conn_id = conn_id;
-    p_clcb->transport = transport;
-
-    bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_CONN_EVT, NULL);
-  }
 
   notify.handle = handle;
 
@@ -1264,6 +1250,21 @@ void bta_gattc_process_indicate(uint16_t conn_id, tGATTC_OPTYPE op,
 
   /* if app registered for the notification */
   if (bta_gattc_check_notif_registry(p_clrcb, p_srcb, &notify)) {
+    /* connection not open yet */
+    if (p_clcb == NULL) {
+      p_clcb = bta_gattc_clcb_alloc(gatt_if, remote_bda, transport);
+
+      if (p_clcb == NULL) {
+        LOG(ERROR) << "No resources";
+        return;
+      }
+
+      p_clcb->bta_conn_id = conn_id;
+      p_clcb->transport = transport;
+
+      bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_CONN_EVT, NULL);
+    }
+
     if (p_clcb != NULL)
       bta_gattc_proc_other_indication(p_clcb, op, p_data, &notify);
   }