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

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

mock: [60/63] Remove BTM_UseLeLink

Use get_btm_client_interface() instead

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

Change-Id: Ic2f7bb9ed48bee4cd055d30fb5c9c5179bd3c61b
parent ac288e0d
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -34,17 +34,13 @@
#include "bta/include/bta_hh_api.h"
#include "bta/include/bta_hh_co.h"
#include "bta/sys/bta_sys.h"
#include "btif/include/btif_storage.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "stack/include/acl_api.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_log_history.h"
#include "stack/include/hiddefs.h"
#include "stack/include/hidh_api.h"
#include "stack/include/sdp_api.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"

using namespace bluetooth::legacy::stack::sdp;
@@ -925,7 +921,9 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
      if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) {
        tBT_TRANSPORT transport = p_data->api_maintdev.link_spec.transport;
        if (!com::android::bluetooth::flags::allow_switching_hid_and_hogp()) {
          transport = BTM_UseLeLink(p_data->api_maintdev.link_spec.addrt.bda) ? BT_TRANSPORT_LE
          transport = get_btm_client_interface().ble.BTM_UseLeLink(
                              p_data->api_maintdev.link_spec.addrt.bda)
                              ? BT_TRANSPORT_LE
                              : BT_TRANSPORT_BR_EDR;
        }
        if (transport == BT_TRANSPORT_LE) {
+2 −2
Original line number Diff line number Diff line
@@ -848,7 +848,7 @@ tBTM_STATUS BTM_CancelRemoteDeviceName(void) {
  if (com::android::bluetooth::flags::rnr_store_device_type()) {
    is_le = (btm_cb.rnr.remname_dev_type == BT_DEVICE_TYPE_BLE);
  } else {
    is_le = BTM_UseLeLink(btm_cb.rnr.remname_bda);
    is_le = get_btm_client_interface().ble.BTM_UseLeLink(btm_cb.rnr.remname_bda);
  }

  if (is_le) {
@@ -1922,7 +1922,7 @@ void btm_process_remote_name(const RawAddress* bda, const BD_NAME bdn, uint16_t
  if (com::android::bluetooth::flags::rnr_store_device_type()) {
    on_le_link = (btm_cb.rnr.remname_dev_type == BT_DEVICE_TYPE_BLE);
  } else {
    on_le_link = BTM_UseLeLink(btm_cb.rnr.remname_bda);
    on_le_link = get_btm_client_interface().ble.BTM_UseLeLink(btm_cb.rnr.remname_bda);
  }

  /* If the inquire BDA and remote DBA are the same, then stop the timer and set
+2 −1
Original line number Diff line number Diff line
@@ -808,7 +808,8 @@ tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
                        tBT_TRANSPORT transport, tBT_DEVICE_TYPE /* device_type */) {
  if (transport == BT_TRANSPORT_AUTO) {
    if (addr_type == BLE_ADDR_PUBLIC) {
      transport = BTM_UseLeLink(bd_addr) ? BT_TRANSPORT_LE : BT_TRANSPORT_BR_EDR;
      transport = get_btm_client_interface().ble.BTM_UseLeLink(bd_addr) ? BT_TRANSPORT_LE
                                                                        : BT_TRANSPORT_BR_EDR;
    } else {
      log::info("Forcing transport LE (was auto) because of the address type");
      transport = BT_TRANSPORT_LE;
+2 −3
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "osi/include/mutex.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/btm_client_interface.h"
#include "types/raw_address.h"

using namespace bluetooth;
@@ -103,8 +104,6 @@ static tGAP_CCB* gap_allocate_ccb(void);
static void gap_release_ccb(tGAP_CCB* p_ccb);
static void gap_checks_con_flags(tGAP_CCB* p_ccb);

bool BTM_UseLeLink(const RawAddress& bd_addr);

/*******************************************************************************
 *
 * Function         gap_conn_init
@@ -622,7 +621,7 @@ static void gap_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, uint1
    log::warn("*******");

    /* Disconnect because it is an unexpected connection */
    if (BTM_UseLeLink(bd_addr)) {
    if (get_btm_client_interface().ble.BTM_UseLeLink(bd_addr)) {
      if (!L2CA_DisconnectLECocReq(l2cap_cid)) {
        log::warn("Unable to request L2CAP disconnect le_coc peer:{} cid:{}", bd_addr, l2cap_cid);
      }
+0 −6
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ struct BTM_GetRemoteDeviceName BTM_GetRemoteDeviceName;
struct BTM_SecAddBleDevice BTM_SecAddBleDevice;
struct BTM_SecAddBleKey BTM_SecAddBleKey;
struct BTM_SecurityGrant BTM_SecurityGrant;
struct BTM_UseLeLink BTM_UseLeLink;
struct btm_ble_connected btm_ble_connected;
struct btm_ble_get_acl_remote_addr btm_ble_get_acl_remote_addr;
struct btm_ble_get_enc_key_type btm_ble_get_enc_key_type;
@@ -99,7 +98,6 @@ const Octet16 BTM_GetDeviceEncRoot::return_value{0xd5, 0xcb, 0x84, 0x54, 0xd1, 0
                                                 0xff, 0xff, 0xb2, 0xec, 0x71, 0x2b, 0xae, 0xab};
const Octet16 BTM_GetDeviceIDRoot::return_value{0xd5, 0xcb, 0x84, 0x54, 0xd1, 0x77, 0x73, 0x3e,
                                                0xff, 0xff, 0xb2, 0xec, 0x71, 0x2b, 0xae, 0xab};
bool BTM_UseLeLink::return_value = false;
bool btm_ble_get_acl_remote_addr::return_value = false;
bool btm_ble_get_enc_key_type::return_value = false;
uint8_t btm_ble_read_sec_key_size::return_value = 0;
@@ -193,10 +191,6 @@ void BTM_SecurityGrant(const RawAddress& bd_addr, uint8_t res) {
  inc_func_call_count(__func__);
  test::mock::stack_btm_ble::BTM_SecurityGrant(bd_addr, res);
}
bool BTM_UseLeLink(const RawAddress& bd_addr) {
  inc_func_call_count(__func__);
  return test::mock::stack_btm_ble::BTM_UseLeLink(bd_addr);
}
void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode, uint8_t role,
                       tBLE_ADDR_TYPE addr_type, bool addr_matched,
                       bool can_read_discoverable_characteristics) {
Loading