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

Commit 52166733 authored by Chris Manton's avatar Chris Manton Committed by Gerrit Code Review
Browse files

Merge changes If48ed4ab,I2b09973d,I4298c447,I31e315f9,I57d203b7 into main

* changes:
  mock: [15/63] Remove BTM_EScoConnRsp
  mock: [14/63] Remove BTM_default_unblock_role_switch
  mock: [13/63] Remove BTM_CreateSco use btm_client_interface
  mock: [12/63] Remove BTM_ClearInqDb
  mock: [11/63] Remove BTM_CancelRemoteDeviceName
parents 9be86ec3 7a3702be
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -379,8 +379,8 @@ static void bta_ag_esco_connreq_cback(tBTM_ESCO_EVT event, tBTM_ESCO_EVT_DATA* p
      log::warn("reject incoming SCO connection, remote_bda={}, active_bda={}, current_bda={}",
                remote_bda ? *remote_bda : RawAddress::kEmpty, active_device_addr,
                p_scb ? p_scb->peer_addr : RawAddress::kEmpty);
      BTM_EScoConnRsp(p_data->conn_evt.sco_inx, HCI_ERR_HOST_REJECT_RESOURCES,
                      (enh_esco_params_t*)nullptr);
      get_btm_client_interface().sco.BTM_EScoConnRsp(
              p_data->conn_evt.sco_inx, HCI_ERR_HOST_REJECT_RESOURCES, (enh_esco_params_t*)nullptr);
    }
  }
}
@@ -552,8 +552,9 @@ void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) {
      }
    }

    if (BTM_CreateSco(&p_scb->peer_addr, true, params.packet_types, &p_scb->sco_idx,
                      bta_ag_sco_conn_cback, bta_ag_sco_disc_cback) == BTM_CMD_STARTED) {
    if (get_btm_client_interface().sco.BTM_CreateSco(&p_scb->peer_addr, true, params.packet_types,
                                                     &p_scb->sco_idx, bta_ag_sco_conn_cback,
                                                     bta_ag_sco_disc_cback) == BTM_CMD_STARTED) {
      /* Initiating the connection, set the current sco handle */
      bta_ag_cb.sco.cur_idx = p_scb->sco_idx;
      /* Configure input/output data. */
@@ -565,9 +566,9 @@ void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) {
               params.packet_types);
  } else {
    /* Not initiating, go to listen mode */
    tBTM_STATUS btm_status =
            BTM_CreateSco(&p_scb->peer_addr, false, params.packet_types, &p_scb->sco_idx,
                          bta_ag_sco_conn_cback, bta_ag_sco_disc_cback);
    tBTM_STATUS btm_status = get_btm_client_interface().sco.BTM_CreateSco(
            &p_scb->peer_addr, false, params.packet_types, &p_scb->sco_idx, bta_ag_sco_conn_cback,
            bta_ag_sco_disc_cback);
    if (btm_status == BTM_CMD_STARTED) {
      if (get_btm_client_interface().sco.BTM_RegForEScoEvts(
                  p_scb->sco_idx, bta_ag_esco_connreq_cback) != BTM_SUCCESS) {
@@ -1520,7 +1521,7 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB* p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA* p_data
    params = esco_parameters_for_codec(SCO_CODEC_CVSD_D1, offload);
  }

  BTM_EScoConnRsp(p_scb->sco_idx, HCI_SUCCESS, &params);
  get_btm_client_interface().sco.BTM_EScoConnRsp(p_scb->sco_idx, HCI_SUCCESS, &params);
  log::verbose("listening for SCO connection");
}

+1 −1
Original line number Diff line number Diff line
@@ -2401,7 +2401,7 @@ void bta_av_str_closed(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {

  BTM_unblock_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
  if (bta_av_cb.audio_open_cnt <= 1) {
    BTM_default_unblock_role_switch();
    get_btm_client_interface().link_policy.BTM_default_unblock_role_switch();
  }

  L2CA_SetMediaStreamChannel(p_scb->l2c_cid, false);
+2 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_types.h"
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/l2c_api.h"
#include "stack/include/sdp_api.h"
#include "types/raw_address.h"
@@ -1349,7 +1350,7 @@ void bta_av_conn_chg(tBTA_AV_DATA* p_data) {
    if (p_cb->audio_open_cnt == 1) {
      /* one audio channel goes down and there's one audio channel remains open.
       * restore the switch role in default link policy */
      BTM_default_unblock_role_switch();
      get_btm_client_interface().link_policy.BTM_default_unblock_role_switch();
      bta_av_restore_switch();
    }
    if (p_cb->audio_open_cnt) {
+4 −3
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ static void bta_hf_client_sco_conn_rsp(tBTA_HF_CLIENT_CB* client_cb,
    hci_status = HCI_ERR_HOST_REJECT_DEVICE;
  }

  BTM_EScoConnRsp(p_data->sco_inx, hci_status, &resp);
  get_btm_client_interface().sco.BTM_EScoConnRsp(p_data->sco_inx, hci_status, &resp);
}

/*******************************************************************************
@@ -259,7 +259,8 @@ static void bta_hf_client_sco_create(tBTA_HF_CLIENT_CB* client_cb, bool is_orig)
    bta_sys_sco_use(BTA_ID_HS, 1, client_cb->peer_addr);
  }

  status = BTM_CreateSco(&client_cb->peer_addr, is_orig, params.packet_types, &client_cb->sco_idx,
  status = get_btm_client_interface().sco.BTM_CreateSco(
          &client_cb->peer_addr, is_orig, params.packet_types, &client_cb->sco_idx,
          bta_hf_client_sco_conn_cback, bta_hf_client_sco_disc_cback);
  if (status == BTM_CMD_STARTED && !is_orig) {
    if (!BTM_RegForEScoEvts(client_cb->sco_idx, bta_hf_client_esco_connreq_cback)) {
+16 −1
Original line number Diff line number Diff line
@@ -272,10 +272,18 @@ TEST_F_WITH_FLAGS(BtaAgCmdTest, at_hfp_cback__qcs_ev_codec_disabled,
TEST_F_WITH_FLAGS(BtaAgCmdTest, at_hfp_cback__qcs_ev_codec_q0_enabled,
                  REQUIRES_FLAGS_ENABLED(ACONFIG_FLAG(TEST_BT, hfp_codec_aptx_voice))) {
  reset_mock_btm_client_interface();
  mock_btm_client_interface.sco.BTM_SetEScoMode = [](enh_esco_params_t* p_parms) -> tBTM_STATUS {
  mock_btm_client_interface.sco.BTM_SetEScoMode =
          [](enh_esco_params_t* /* p_parms */) -> tBTM_STATUS {
    inc_func_call_count("BTM_SetEScoMode");
    return BTM_SUCCESS;
  };
  mock_btm_client_interface.sco.BTM_CreateSco =
          [](const RawAddress* /* remote_bda */, bool /* is_orig */, uint16_t /* pkt_types */,
             uint16_t* /* p_sco_inx */, tBTM_SCO_CB* /* p_conn_cb */,
             tBTM_SCO_CB* /* p_disc_cb */) -> tBTM_STATUS {
    inc_func_call_count("BTM_CreateSco");
    return BTM_CMD_STARTED;
  };

  tBTA_AG_SCB p_scb = {.peer_addr = addr,
                       .sco_idx = BTM_INVALID_SCO_INDEX,
@@ -309,6 +317,13 @@ TEST_F_WITH_FLAGS(BtaAgCmdTest, handle_swb_at_event__qcs_ev_codec_q1_fallback_to
    inc_func_call_count("BTM_SetEScoMode");
    return BTM_SUCCESS;
  };
  mock_btm_client_interface.sco.BTM_CreateSco =
          [](const RawAddress* /* remote_bda */, bool /* is_orig */, uint16_t /* pkt_types */,
             uint16_t* /* p_sco_inx */, tBTM_SCO_CB* /* p_conn_cb */,
             tBTM_SCO_CB* /* p_disc_cb */) -> tBTM_STATUS {
    inc_func_call_count("BTM_CreateSco");
    return BTM_CMD_STARTED;
  };

  tBTA_AG_SCB p_scb = {.peer_addr = addr,
                       .sco_idx = BTM_INVALID_SCO_INDEX,
Loading