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

Commit 33af51c4 authored by Chris Manton's avatar Chris Manton
Browse files

Introduce BTM_IsRemoteNameKnown

Bug: 260598196
Bug: 254358644
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines
Ignore-AOSP-First: Cherry-pick

Merged-In: I0042d9c99fec23cad52cdc9b9971c1b92366a7c9
Change-Id: I0042d9c99fec23cad52cdc9b9971c1b92366a7c9
parent 7b8603bf
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@

#define LOG_TAG "bluetooth"

#include <base/logging.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -41,6 +42,7 @@
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "stack/btm/btm_ble_int.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/acl_api.h"
#include "stack/include/bt_hdr.h"
@@ -50,8 +52,6 @@
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"

#include <base/logging.h>

namespace {
constexpr char kBtmLogTag[] = "SCAN";
}
@@ -640,6 +640,11 @@ tBTM_STATUS BTM_CancelRemoteDeviceName(void) {
    return (BTM_WRONG_MODE);
}

bool BTM_IsRemoteNameKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
  return (p_dev_rec == nullptr) ? false : p_dev_rec->is_name_known();
}

/*******************************************************************************
 *
 * Function         BTM_InqDbRead
+16 −0
Original line number Diff line number Diff line
@@ -402,6 +402,22 @@ tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda,
 ******************************************************************************/
tBTM_STATUS BTM_CancelRemoteDeviceName(void);

/*******************************************************************************
 *
 * Function         BTM_IsRemoteNameKnown
 *
 * Description      This function checks if the remote name is known.
 *
 * Input Params:    bd_addr: Address of remote
 *                  transport: Transport, auto if unknown
 *
 * Returns
 *                  true if name is known, false otherwise
 *
 ******************************************************************************/
bool BTM_IsRemoteNameKnown(const RawAddress& remote_bda,
                           tBT_TRANSPORT transport);

/*******************************************************************************
 *
 * Function         BTM_ReadRemoteVersion
+4 −0
Original line number Diff line number Diff line
@@ -177,3 +177,7 @@ void btm_set_eir_uuid(const uint8_t* p_eir, tBTM_INQ_RESULTS* p_results) {
  mock_function_count_map[__func__]++;
}
void btm_sort_inq_result(void) { mock_function_count_map[__func__]++; }
bool BTM_IsRemoteNameKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  mock_function_count_map[__func__]++;
  return false;
}