Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 546bd393 authored by Nitin Arora's avatar Nitin Arora
Browse files

Send GATT discovery complete only if discovery is active

This change forces a discovery complete event at gatt close
event only if service discovery is in progress and not when
inquiry is on going. Otherwise, a false discovery complete
is sent to the host, which cause a never ending inquiry.

Change-Id: I7ca207382b04ed233c149ca50040dab993067870
parent 71c6f7ed
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -5578,6 +5578,7 @@ static void bta_dm_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
            APPL_TRACE_DEBUG("BTA_GATTC_CLOSE_EVT reason = %d", p_data->close.reason);
            APPL_TRACE_DEBUG("BTA_GATTC_CLOSE_EVT reason = %d", p_data->close.reason);
            /* in case of disconnect before search is completed */
            /* in case of disconnect before search is completed */
            if ( (bta_dm_search_cb.state != BTA_DM_SEARCH_IDLE) &&
            if ( (bta_dm_search_cb.state != BTA_DM_SEARCH_IDLE) &&
                 (bta_dm_search_cb.state != BTA_DM_SEARCH_ACTIVE) &&
                 !memcmp(p_data->close.remote_bda, bta_dm_search_cb.peer_bdaddr, BD_ADDR_LEN))
                 !memcmp(p_data->close.remote_bda, bta_dm_search_cb.peer_bdaddr, BD_ADDR_LEN))
            {
            {
                bta_dm_gatt_disc_complete((UINT16)BTA_GATT_INVALID_CONN_ID,  (tBTA_GATT_STATUS) BTA_GATT_ERROR);
                bta_dm_gatt_disc_complete((UINT16)BTA_GATT_INVALID_CONN_ID,  (tBTA_GATT_STATUS) BTA_GATT_ERROR);