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

Commit 2ddda014 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Always disconnect ACL by handle

Test: cert/run
Tag: #gd-refactor
Bug: 141555841
Change-Id: Ib106ff802eccdcde09f9c9a19ef595ddfab1ace2
parent ae094b36
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -2769,16 +2769,6 @@ void acl_reject_connection_request(const RawAddress& bd_addr, uint8_t reason) {
  btsnd_hcic_reject_conn(bd_addr, reason);
}

void acl_disconnect(const RawAddress& bd_addr, tBT_TRANSPORT transport,
                    tHCI_STATUS reason) {
  tACL_CONN* p_acl = internal_.btm_bda_to_acl(bd_addr, transport);
  if (p_acl == nullptr) {
    LOG_WARN("Unable to find active acl");
    return;
  }
  hci_btsnd_hcic_disconnect(*p_acl, reason);
}

void acl_disconnect_from_handle(uint16_t handle, tHCI_STATUS reason) {
  acl_disconnect_after_role_switch(handle, reason);
}
+0 −2
Original line number Diff line number Diff line
@@ -313,8 +313,6 @@ void btm_acl_created(const RawAddress& bda, uint16_t hci_handle,

void btm_acl_removed(uint16_t handle);

void acl_disconnect(const RawAddress& bd_addr, tBT_TRANSPORT transport,
                    tHCI_STATUS reason);
void acl_disconnect_from_handle(uint16_t handle, tHCI_STATUS reason);
void acl_disconnect_after_role_switch(uint16_t conn_handle, tHCI_STATUS reason);

+1 −2
Original line number Diff line number Diff line
@@ -564,8 +564,7 @@ static void l2c_csm_term_w4_sec_comp(tL2C_CCB* p_ccb, uint16_t event,

    case L2CEVT_TIMEOUT:
      /* SM4 related. */
      acl_disconnect(p_ccb->p_lcb->remote_bd_addr, p_ccb->p_lcb->transport,
                     HCI_ERR_AUTH_FAILURE);
      acl_disconnect_from_handle(p_ccb->p_lcb->Handle(), HCI_ERR_AUTH_FAILURE);
      break;

    case L2CEVT_SEC_RE_SEND_CMD: /* BTM has enough info to proceed */
+1 −2
Original line number Diff line number Diff line
@@ -506,8 +506,7 @@ void l2c_link_timeout(tL2C_LCB* p_lcb) {
        /* BTM is still executing security process. Let lcb stay as connected */
        start_timeout = false;
      } else if (p_lcb->IsBonding()) {
        acl_disconnect(p_lcb->remote_bd_addr, p_lcb->transport,
                       HCI_ERR_PEER_USER);
        acl_disconnect_from_handle(p_lcb->Handle(), HCI_ERR_PEER_USER);
        l2cu_process_fixed_disc_cback(p_lcb);
        p_lcb->link_state = LST_DISCONNECTING;
        timeout_ms = L2CAP_LINK_DISCONNECT_TIMEOUT_MS;
+2 −4
Original line number Diff line number Diff line
@@ -1502,8 +1502,7 @@ bool l2cu_start_post_bond_timer(uint16_t handle) {
    uint64_t timeout_ms = L2CAP_BONDING_TIMEOUT * 1000;

    if (p_lcb->idle_timeout == 0) {
      acl_disconnect(p_lcb->remote_bd_addr, p_lcb->transport,
                     HCI_ERR_PEER_USER);
      acl_disconnect_from_handle(p_lcb->Handle(), HCI_ERR_PEER_USER);
      p_lcb->link_state = LST_DISCONNECTING;
      timeout_ms = L2CAP_LINK_DISCONNECT_TIMEOUT_MS;
    }
@@ -2490,8 +2489,7 @@ void l2cu_no_dynamic_ccbs(tL2C_LCB* p_lcb) {
      p_lcb->link_state = LST_DISCONNECTING;
      start_timeout = false;
    } else if (p_lcb->IsBonding()) {
      acl_disconnect(p_lcb->remote_bd_addr, p_lcb->transport,
                     HCI_ERR_PEER_USER);
      acl_disconnect_from_handle(p_lcb->Handle(), HCI_ERR_PEER_USER);
      l2cu_process_fixed_disc_cback(p_lcb);
      p_lcb->link_state = LST_DISCONNECTING;
      timeout_ms = L2CAP_LINK_DISCONNECT_TIMEOUT_MS;