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

Commit 6933343f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Remove from filter accept list upon cancel connect" am: c0ff7038 am: f4231e2a

parents c10c6474 f4231e2a
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -251,10 +251,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;
  }
@@ -264,8 +269,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);
    }