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

Commit 5d663b71 authored by Chris Manton's avatar Chris Manton
Browse files

stack::SendRemoteNameRequest Remove unnecessary layer of indirection

Bug: 346441506
Test: m .
Flag: EXEMPT, Mechanical Refactor
Change-Id: I95e5eadddd0ef408ca6dcd9c4d44d917b5cb2526
parent 00d4d51b
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -248,10 +248,6 @@ static const uint8_t* btm_eir_get_uuid_list(const uint8_t* p_eir,
                                            uint8_t* p_num_uuid,
                                            uint8_t* p_uuid_list_type);

void SendRemoteNameRequest(const RawAddress& raw_address) {
  bluetooth::shim::ACL_RemoteNameRequest(raw_address, HCI_PAGE_SCAN_REP_MODE_R1,
                                         HCI_MANDATARY_PAGE_SCAN_MODE, 0);
}
static void btm_process_cancel_complete(tHCI_STATUS status, uint8_t mode);
static void on_incoming_hci_event(bluetooth::hci::EventView event);
static bool is_inquery_by_rssi() {
+9 −3
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include "hci/controller_interface.h"
#include "internal_include/bt_target.h"
#include "l2c_api.h"
#include "main/shim/acl_api.h"
#include "main/shim/entry.h"
#include "main/shim/helpers.h"
#include "osi/include/allocator.h"
@@ -4075,7 +4076,8 @@ void btm_sec_link_key_notification(const RawAddress& p_bda,
    /* If it is for bonding nothing else will follow, so we need to start name
     * resolution */
    if (we_are_bonding) {
      SendRemoteNameRequest(p_bda);
      bluetooth::shim::ACL_RemoteNameRequest(p_bda, HCI_PAGE_SCAN_REP_MODE_R1,
                                             HCI_MANDATARY_PAGE_SCAN_MODE, 0);
    }

    log::verbose("rmt_io_caps:{}, sec_flags:x{:x}, dev_class[1]:x{:02x}",
@@ -4386,7 +4388,9 @@ void btm_sec_pin_code_request(const RawAddress p_bda) {
      /* We received PIN code request for the device with unknown name */
      /* it is not user friendly just to ask for the PIN without name */
      /* try to get name at first */
      SendRemoteNameRequest(p_dev_rec->bd_addr);
      bluetooth::shim::ACL_RemoteNameRequest(p_dev_rec->bd_addr,
                                             HCI_PAGE_SCAN_REP_MODE_R1,
                                             HCI_MANDATARY_PAGE_SCAN_MODE, 0);
    }
  }

@@ -4590,7 +4594,9 @@ static bool btm_sec_start_get_name(tBTM_SEC_DEV_REC* p_dev_rec) {

  /* 0 and NULL are as timeout and callback params because they are not used in
   * security get name case */
  SendRemoteNameRequest(p_dev_rec->bd_addr);
  bluetooth::shim::ACL_RemoteNameRequest(p_dev_rec->bd_addr,
                                         HCI_PAGE_SCAN_REP_MODE_R1,
                                         HCI_MANDATARY_PAGE_SCAN_MODE, 0);
  return true;
}

+0 −5
Original line number Diff line number Diff line
@@ -729,11 +729,6 @@ void BTM_RemoveEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
                                         uint8_t* p_uuid_list,
                                         uint8_t max_num_uuid);

/**
 * Send remote name request, either to legacy HCI, or to GD shim Name module
 */
void SendRemoteNameRequest(const RawAddress& raw_address);

[[nodiscard]] bool BTM_IsScoActiveByBdaddr(const RawAddress& remote_bda);

/* Read maximum data packet that can be sent over current connection */
+0 −5
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ struct BTM_SetDiscoverability BTM_SetDiscoverability;
struct BTM_SetInquiryMode BTM_SetInquiryMode;
struct BTM_StartInquiry BTM_StartInquiry;
struct BTM_WriteEIR BTM_WriteEIR;
struct SendRemoteNameRequest SendRemoteNameRequest;
struct btm_clear_all_pending_le_entry btm_clear_all_pending_le_entry;
struct btm_clr_inq_db btm_clr_inq_db;
struct btm_clr_inq_result_flt btm_clr_inq_result_flt;
@@ -195,10 +194,6 @@ tBTM_STATUS BTM_WriteEIR(BT_HDR* p_buff) {
  inc_func_call_count(__func__);
  return test::mock::stack_btm_inq::BTM_WriteEIR(p_buff);
}
void SendRemoteNameRequest(const RawAddress& raw_address) {
  inc_func_call_count(__func__);
  test::mock::stack_btm_inq::SendRemoteNameRequest(raw_address);
}
void btm_clear_all_pending_le_entry(void) {
  inc_func_call_count(__func__);
  test::mock::stack_btm_inq::btm_clear_all_pending_le_entry();
+0 −10
Original line number Diff line number Diff line
@@ -290,16 +290,6 @@ struct BTM_WriteEIR {
};
extern struct BTM_WriteEIR BTM_WriteEIR;

// Name: SendRemoteNameRequest
// Params: const RawAddress& raw_address
// Return: void
struct SendRemoteNameRequest {
  std::function<void(const RawAddress& raw_address)> body{
      [](const RawAddress& /* raw_address */) {}};
  void operator()(const RawAddress& raw_address) { body(raw_address); };
};
extern struct SendRemoteNameRequest SendRemoteNameRequest;

// Name: btm_clear_all_pending_le_entry
// Params: void
// Return: void