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

Commit cd307b24 authored by howardchung's avatar howardchung
Browse files

Floss: Add support of inquiry by rssi in Floss

This allows Floss to use the sysprop: inq_by_rssi which modifies the
logic when the inquiry database is full from replacing the oldeset one
to replacing the one with the smallest rssi.

Bug: 236225499
Bug: 284813189
Test: manually
Change-Id: Ic2488e9ce847c835de568a6225d0fab90cb61b19
parent e83cfa05
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ void SyspropsModule::parse_config(std::string file_path) {
      "bluetooth.device_id.product_version",
      "bluetooth.device_id.vendor_id",
      "bluetooth.device_id.vendor_id_source",
      "persist.bluetooth.inq_by_rssi",
      // BR/EDR
      "bluetooth.core.classic.page_scan_type",
      "bluetooth.core.classic.page_scan_interval",
+6 −2
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ uint16_t max_bd_entries_; /* Maximum number of entries that can be stored */
}  // namespace

extern tBTM_CB btm_cb;

void btm_inq_db_set_inq_by_rssi(void);
void btm_inq_remote_name_timer_timeout(void* data);
tBTM_STATUS btm_ble_read_remote_name(const RawAddress& remote_bda,
                                     tBTM_NAME_CMPL_CB* p_cb);
@@ -968,13 +968,17 @@ void btm_inq_db_init(void) {
  btm_cb.btm_inq_vars.remote_name_timer =
      alarm_new("btm_inq.remote_name_timer");
  btm_cb.btm_inq_vars.no_inc_ssp = BTM_NO_SSP_ON_INQUIRY;
  internal_.inq_by_rssi = osi_property_get_bool(PROPERTY_INQ_BY_RSSI, false);
  btm_inq_db_set_inq_by_rssi();
}

void btm_inq_db_free(void) {
  alarm_free(btm_cb.btm_inq_vars.remote_name_timer);
}

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_stop_on_ssp
+6 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include "osi/include/log.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/inq_hci_link_interface.h"
#include "stack_config.h"
#include "types/raw_address.h"

@@ -53,6 +54,11 @@ void btm_init(void) {
  btm_cb.Init(stack_config_get_interface()->get_pts_secure_only_mode()
                  ? BTM_SEC_MODE_SC
                  : BTM_SEC_MODE_SP);
#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 */
+1 −0
Original line number Diff line number Diff line
@@ -34,3 +34,4 @@ void btm_process_cancel_complete(tHCI_STATUS status, uint8_t mode);

void btm_acl_process_sca_cmpl_pkt(uint8_t len, uint8_t* data);
tINQ_DB_ENT* btm_inq_db_new(const RawAddress& p_bda);
void btm_inq_db_set_inq_by_rssi(void);