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

Commit 8f61e3db authored by Yun-Hao Chung's avatar Yun-Hao Chung Committed by Yun-hao Chung
Browse files

Floss: Remove TARGET_FLOSS in inq_by_rssi

inq_by_rssi is controllable by sysprop, but Floss used to need
additional code because the initialization path was different.
Now looking again at the code, simplify the code to check the
sysprop directly seems to be a better option.

Bug: 345381407
Tag: #floss
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT, mechanical refactor - no logical change

Change-Id: I961080f3ed6aff56166c9ecb6caa96781037800b
parent bf455766
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -92,10 +92,6 @@
namespace {
constexpr char kBtmLogTag[] = "SCAN";

struct {
  bool inq_by_rssi{false};
} internal_;

void btm_log_history_scan_mode(uint8_t scan_mode) {
  static uint8_t scan_mode_cached_ = 0xff;
  if (scan_mode_cached_ == scan_mode) return;
@@ -258,6 +254,9 @@ void SendRemoteNameRequest(const RawAddress& raw_address) {
}
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() {
  return osi_property_get_bool(PROPERTY_INQ_BY_RSSI, false);
}
/*******************************************************************************
 *
 * Function         BTM_SetDiscoverability
@@ -1078,10 +1077,6 @@ void btm_inq_db_reset(void) {
  return;
}

void btm_inq_db_set_inq_by_rssi(void) {
  internal_.inq_by_rssi = osi_property_get_bool(PROPERTY_INQ_BY_RSSI, false);
}

/*******************************************************************************
 *
 * Function         btm_inq_clear_ssp
@@ -1254,7 +1249,7 @@ tINQ_DB_ENT* btm_inq_db_new(const RawAddress& p_bda, bool is_ble) {
      return (p_ent);
    }

    if (internal_.inq_by_rssi) {
    if (is_inquery_by_rssi()) {
      if (p_ent->inq_info.results.rssi < i_rssi) {
        p_old = p_ent;
        i_rssi = p_ent->inq_info.results.rssi;
+0 −10
Original line number Diff line number Diff line
@@ -33,10 +33,6 @@
#include "stack/include/security_client_callbacks.h"
#include "types/raw_address.h"

#ifdef TARGET_FLOSS
#include "stack/include/inq_hci_link_interface.h"  // btm_inq_db_set_inq_by_rssi
#endif                                             // TARGET_FLOSS

using namespace bluetooth;

/* Global BTM control block structure
@@ -58,12 +54,6 @@ tBTM_CB btm_cb;
void btm_init(void) {
  btm_cb.Init();
  get_security_client_interface().BTM_Sec_Init();

#ifdef TARGET_FLOSS
  // Need to set inquery by rssi flag for Floss since Floss doesn't do
  // btm_inq_db_init
  btm_inq_db_set_inq_by_rssi();
#endif
}

/** This function is called to free dynamic memory and system resource allocated by btm_init */