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

Commit a05d4199 authored by Chris Manton's avatar Chris Manton
Browse files

stack::l2cap [15/19] L2CA_SetIdleTimeoutByBdAddr

Bug: 339732512
Test: m .
Flag: EXEMPT, Logging Change

Change-Id: I95e5d9844e81e3f787278043650579bceff1beeb
parent f3511248
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -708,7 +708,9 @@ void bta_ag_rfc_data(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /* data */) {
void bta_ag_start_close(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) {
  /* Take the link out of sniff and set L2C idle time to 0 */
  bta_dm_pm_active(p_scb->peer_addr);
  L2CA_SetIdleTimeoutByBdAddr(p_scb->peer_addr, 0, BT_TRANSPORT_BR_EDR);
  if (!L2CA_SetIdleTimeoutByBdAddr(p_scb->peer_addr, 0, BT_TRANSPORT_BR_EDR)) {
    log::warn("Unable to set idle timeout peer:{}", p_scb->peer_addr);
  }

  /* if SCO is open close SCO and wait on RFCOMM close */
  if (bta_ag_sco_is_open(p_scb)) {
+10 −2
Original line number Diff line number Diff line
@@ -306,8 +306,16 @@ void BTA_dm_on_hw_on() {
void bta_dm_disable() {
  /* Set l2cap idle timeout to 0 (so BTE immediately disconnects ACL link after
   * last channel is closed) */
  L2CA_SetIdleTimeoutByBdAddr(RawAddress::kAny, 0, BT_TRANSPORT_BR_EDR);
  L2CA_SetIdleTimeoutByBdAddr(RawAddress::kAny, 0, BT_TRANSPORT_LE);
  if (!L2CA_SetIdleTimeoutByBdAddr(RawAddress::kAny, 0, BT_TRANSPORT_BR_EDR)) {
    log::warn(
        "Unable to set L2CAP idle timeout peer:{} transport:{} timeout:{}",
        RawAddress::kAny, BT_TRANSPORT_BR_EDR, 0);
  }
  if (!L2CA_SetIdleTimeoutByBdAddr(RawAddress::kAny, 0, BT_TRANSPORT_LE)) {
    log::warn(
        "Unable to set L2CAP idle timeout peer:{} transport:{} timeout:{}",
        RawAddress::kAny, BT_TRANSPORT_LE, 0);
  }

  /* disable all active subsystems */
  bta_sys_disable();
+6 −1
Original line number Diff line number Diff line
@@ -62,7 +62,12 @@ void bta_hf_client_start_close(tBTA_HF_CLIENT_DATA* p_data) {

  /* Take the link out of sniff and set L2C idle time to 0 */
  bta_dm_pm_active(client_cb->peer_addr);
  L2CA_SetIdleTimeoutByBdAddr(client_cb->peer_addr, 0, BT_TRANSPORT_BR_EDR);
  if (!L2CA_SetIdleTimeoutByBdAddr(client_cb->peer_addr, 0,
                                   BT_TRANSPORT_BR_EDR)) {
    log::warn(
        "Unable to set L2CAP idle timeout peer:{} transport:{} timeout:{}",
        client_cb->peer_addr, bt_transport_text(BT_TRANSPORT_BR_EDR), 0);
  }

  /* if SCO is open close SCO and wait on RFCOMM close */
  if (client_cb->sco_state == BTA_HF_CLIENT_SCO_OPEN_ST) {
+6 −2
Original line number Diff line number Diff line
@@ -1189,8 +1189,12 @@ void GATT_SetIdleTimeout(const RawAddress& bd_addr, uint16_t idle_tout,
    }

    if (idle_tout == GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP) {
      L2CA_SetIdleTimeoutByBdAddr(
          p_tcb->peer_bda, GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP, BT_TRANSPORT_LE);
      if (!L2CA_SetIdleTimeoutByBdAddr(p_tcb->peer_bda,
                                       GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP,
                                       BT_TRANSPORT_LE)) {
        log::warn("Unable to set L2CAP link idle timeout peer:{} transport:{}",
                  p_tcb->peer_bda, bt_transport_text(transport));
      }
    }
  }

+5 −1
Original line number Diff line number Diff line
@@ -700,7 +700,11 @@ tHID_STATUS hidd_conn_disconnect(void) {

    /* Set l2cap idle timeout to 0 (so ACL link is disconnected
     * immediately after last channel is closed) */
    L2CA_SetIdleTimeoutByBdAddr(hd_cb.device.addr, 0, BT_TRANSPORT_BR_EDR);
    if (!L2CA_SetIdleTimeoutByBdAddr(hd_cb.device.addr, 0,
                                     BT_TRANSPORT_BR_EDR)) {
      log::warn("Unable to set L2CAP idle timeout peer:{} transport:{}",
                hd_cb.device.addr, BT_TRANSPORT_BR_EDR);
    }

    if (p_hcon->intr_cid) {
      hidd_l2cif_disconnect(p_hcon->intr_cid);
Loading