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

Commit a5e9eeab authored by Chris Manton's avatar Chris Manton Committed by Jack He
Browse files

Remove from filter accept list upon cancel connect

connection::manager no longer arbitrates filter
accept list manipulation

Bug: 237600252
Test: gd/cert/run, testplans/1181383
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: I2d0d2d64c621d565d1ed985da4b061563029def1
parent 1b21e291
Loading
Loading
Loading
Loading
+16 −3
Original line number Original line 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) {
bool gatt_disconnect(tGATT_TCB* p_tcb) {
  VLOG(1) << __func__;
  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);
  tGATT_CH_STATE ch_state = gatt_get_ch_state(p_tcb);
  if (ch_state == GATT_CH_CLOSING) {
  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";
    VLOG(1) << __func__ << " already in closing state";
    return true;
    return true;
  }
  }
@@ -264,8 +269,16 @@ bool gatt_disconnect(tGATT_TCB* p_tcb) {
      L2CA_RemoveFixedChnl(L2CAP_ATT_CID, p_tcb->peer_bda);
      L2CA_RemoveFixedChnl(L2CAP_ATT_CID, p_tcb->peer_bda);
      gatt_set_ch_state(p_tcb, GATT_CH_CLOSING);
      gatt_set_ch_state(p_tcb, GATT_CH_CLOSING);
    } else {
    } else {
      connection_manager::direct_connect_remove(CONN_MGR_ID_L2CAP,
      if (!connection_manager::direct_connect_remove(CONN_MGR_ID_L2CAP,
                                                p_tcb->peer_bda);
                                                     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,
      gatt_cleanup_upon_disc(p_tcb->peer_bda, GATT_CONN_TERMINATE_LOCAL_HOST,
                             p_tcb->transport);
                             p_tcb->transport);
    }
    }