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

Commit eea12fe3 authored by Kyunglyul Hyun's avatar Kyunglyul Hyun
Browse files

Clean up BtaGattQueue when connected

When BtaGattQueue has a pending task and
if it's disconnected while waiting for
L2CAP connection, GAP_EVT_CONN_CLOSED
is not delivered and BtaGattQueue get stuck.

This change cleans up the queue when connected
to prevent it.

Bug: 343503861
Bug: 379007400
Test: atest bluetooth_csis_test bluetooth_le_audio_client_test bluetooth_has_test
Change-Id: I3c91f5fe9dc052c3fd86689dfcf4ca2106609798
parent e42c8b81
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <base/functional/callback.h>
#include <base/strings/string_number_conversions.h>
#include <bluetooth/log.h>
#include <com_android_bluetooth_flags.h>
#include <hardware/bt_csis.h>
#include <hardware/bt_gatt_types.h>
#include <stdio.h>
@@ -1918,7 +1919,9 @@ private:

    device->connecting_actively = false;
    device->conn_id = evt.conn_id;

    if (com::android::bluetooth::flags::gatt_queue_cleanup_connected()) {
      BtaGattQueue::Clean(evt.conn_id);
    }
    /* Verify bond */
    if (BTM_SecIsSecurityPending(device->addr)) {
      /* if security collision happened, wait for encryption done
+3 −1
Original line number Diff line number Diff line
@@ -2008,7 +2008,9 @@ private:
    }

    device->conn_id = evt.conn_id;

    if (com::android::bluetooth::flags::gatt_queue_cleanup_connected()) {
      BtaGattQueue::Clean(evt.conn_id);
    }
    if (BTM_SecIsSecurityPending(device->addr)) {
      /* if security collision happened, wait for encryption done
       * (BTA_GATTC_ENC_CMPL_CB_EVT)
+4 −0
Original line number Diff line number Diff line
@@ -524,6 +524,10 @@ public:

    hearingDevice->conn_id = conn_id;

    if (com::android::bluetooth::flags::gatt_queue_cleanup_connected()) {
      BtaGattQueue::Clean(conn_id);
    }

    uint64_t hi_sync_id = hearingDevice->hi_sync_id;

    // If there a background connection to the other device of a pair, promote
+3 −0
Original line number Diff line number Diff line
@@ -2309,6 +2309,9 @@ public:

    leAudioDevice->conn_id_ = conn_id;
    leAudioDevice->mtu_ = mtu;
    if (com::android::bluetooth::flags::gatt_queue_cleanup_connected()) {
      BtaGattQueue::Clean(conn_id);
    }

    /* Remove device from the background connect (it might be either Allow list
     * or TA) and add it again with reconnection_mode_. In case it is TA, we are