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

Commit 219535f4 authored by Jack He's avatar Jack He Committed by Automerger Merge Worker
Browse files

Merge "Remove from filter accept list upon cancel connect" into tm-d1-dev am: 03950924

parents c042dfe2 03950924
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);
    }
    }