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

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

mock: [57/63] Remove BTM_SwitchRoleToCentral

Use get_btm_client_interface() instead

Bug: 352129816
Test: m .
Flag: EXEMPT, Test infrastructure

Change-Id: I5aa5674481c41f777632868395a1b628aa730836
parent 4c51ce3d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1089,7 +1089,8 @@ bool bta_av_link_role_ok(tBTA_AV_SCB* p_scb, uint8_t bits) {
            "conn_audio:0x{:x} bits:{} features:0x{:x}",
            p_scb->PeerAddress(), p_scb->hndl, RoleText(role), bta_av_cb.conn_audio, bits,
            bta_av_cb.features);
    const tBTM_STATUS status = BTM_SwitchRoleToCentral(p_scb->PeerAddress());
    const tBTM_STATUS status =
            get_btm_client_interface().link_policy.BTM_SwitchRoleToCentral(p_scb->PeerAddress());
    switch (status) {
      case BTM_CMD_STARTED:
        break;
+4 −1
Original line number Diff line number Diff line
@@ -3115,7 +3115,10 @@ void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) {
        log::info(
                "auth completed in role=peripheral, try to switch role and "
                "encrypt");
        BTM_SwitchRoleToCentral(p_dev_rec->RemoteAddress());
        if (get_btm_client_interface().link_policy.BTM_SwitchRoleToCentral(
                    p_dev_rec->RemoteAddress()) != BTM_CMD_STARTED) {
          log::warn("Unable to switch role to central peer:{}", p_dev_rec->RemoteAddress());
        }
      }

      l2cu_start_post_bond_timer(p_dev_rec->hci_handle);
+2 −1
Original line number Diff line number Diff line
@@ -2119,7 +2119,8 @@ void l2cu_create_conn_br_edr(tL2C_LCB* p_lcb) {
      p_lcb->link_state = LST_CONNECTING_WAIT_SWITCH;
      p_lcb->SetLinkRoleAsCentral();

      if (BTM_SwitchRoleToCentral(p_lcb_cur->remote_bd_addr) == BTM_CMD_STARTED) {
      if (get_btm_client_interface().link_policy.BTM_SwitchRoleToCentral(
                  p_lcb_cur->remote_bd_addr) == BTM_CMD_STARTED) {
        alarm_set_on_mloop(p_lcb->l2c_lcb_timer, L2CAP_LINK_ROLE_SWITCH_TIMEOUT_MS,
                           l2c_lcb_timer_timeout, p_lcb);
        return;
+0 −5
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ struct acl_get_connection_from_handle acl_get_connection_from_handle;
struct BTM_ReadFailedContactCounter BTM_ReadFailedContactCounter;
struct BTM_ReadTxPower BTM_ReadTxPower;
struct BTM_SetLinkSuperTout BTM_SetLinkSuperTout;
struct BTM_SwitchRoleToCentral BTM_SwitchRoleToCentral;
struct btm_remove_acl btm_remove_acl;
struct btm_get_acl_disc_reason_code btm_get_acl_disc_reason_code;
struct btm_is_acl_locally_initiated btm_is_acl_locally_initiated;
@@ -246,10 +245,6 @@ tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda, uint16_t timeout)
  inc_func_call_count(__func__);
  return test::mock::stack_acl::BTM_SetLinkSuperTout(remote_bda, timeout);
}
tBTM_STATUS BTM_SwitchRoleToCentral(const RawAddress& remote_bd_addr) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::BTM_SwitchRoleToCentral(remote_bd_addr);
}
tBTM_STATUS btm_remove_acl(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::btm_remove_acl(bd_addr, transport);
+0 −9
Original line number Diff line number Diff line
@@ -309,15 +309,6 @@ struct BTM_SetLinkSuperTout {
  }
};
extern struct BTM_SetLinkSuperTout BTM_SetLinkSuperTout;
// Name: BTM_SwitchRoleToCentral
// Params: const RawAddress& remote_bd_addr
// Returns: tBTM_STATUS
struct BTM_SwitchRoleToCentral {
  std::function<tBTM_STATUS(const RawAddress& remote_bd_addr)> body{
          [](const RawAddress& /* remote_bd_addr */) { return BTM_SUCCESS; }};
  tBTM_STATUS operator()(const RawAddress& remote_bd_addr) { return body(remote_bd_addr); }
};
extern struct BTM_SwitchRoleToCentral BTM_SwitchRoleToCentral;
// Name: btm_remove_acl
// Params: const RawAddress& bd_addr, tBT_TRANSPORT transport
// Returns: tBTM_STATUS