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

Commit 9ac4a9f1 authored by Jack He's avatar Jack He Committed by Android (Google) Code Review
Browse files

Merge "Remove from filter accept list upon cancel connect" into tm-dev

parents 8c9de96f 32a931ed
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -249,10 +249,15 @@ bool gatt_connect(const RawAddress& rem_bda, tGATT_TCB* p_tcb,
bool gatt_disconnect(tGATT_TCB* p_tcb) {
  VLOG(1) << __func__;

  if (!p_tcb) return false;
  if (!p_tcb) {
    LOG_WARN("Unable to disconnect an unknown device");
    return false;
  }

  tGATT_CH_STATE ch_state = gatt_get_ch_state(p_tcb);
  if (ch_state == GATT_CH_CLOSING) {
    LOG_DEBUG("Device already in closing state peer:%s",
              PRIVATE_ADDRESS(p_tcb->peer_bda));
    VLOG(1) << __func__ << " already in closing state";
    return true;
  }
@@ -262,8 +267,16 @@ bool gatt_disconnect(tGATT_TCB* p_tcb) {
      L2CA_RemoveFixedChnl(L2CAP_ATT_CID, p_tcb->peer_bda);
      gatt_set_ch_state(p_tcb, GATT_CH_CLOSING);
    } else {
      connection_manager::direct_connect_remove(CONN_MGR_ID_L2CAP,
                                                p_tcb->peer_bda);
      if (!connection_manager::direct_connect_remove(CONN_MGR_ID_L2CAP,
                                                     p_tcb->peer_bda)) {
        BTM_AcceptlistRemove(p_tcb->peer_bda);
        LOG_INFO(
            "GATT connection manager has no record but removed filter "
            "acceptlist "
            "gatt_if:%hhu peer:%s",
            static_cast<uint8_t>(CONN_MGR_ID_L2CAP),
            PRIVATE_ADDRESS(p_tcb->peer_bda));
      }
      gatt_cleanup_upon_disc(p_tcb->peer_bda, GATT_CONN_TERMINATE_LOCAL_HOST,
                             p_tcb->transport);
    }