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

Commit 3e7b561e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use empty filter for CSIS discovery" into tm-qpr-dev

parents 0173dd7d 73a8232f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1171,7 +1171,7 @@ class CsisClientImpl : public CsisClient {
  void CsisActiveObserverSet(bool enable) {
  void CsisActiveObserverSet(bool enable) {
    LOG(INFO) << __func__ << " CSIS Discovery SET: " << enable;
    LOG(INFO) << __func__ << " CSIS Discovery SET: " << enable;


    bluetooth::shim::set_ad_type_rsi_filter(enable);
    bluetooth::shim::set_empty_filter(enable);
    BTA_DmBleCsisObserve(
    BTA_DmBleCsisObserve(
        enable, [](tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {
        enable, [](tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {
          /* If there's no instance we are most likely shutting
          /* If there's no instance we are most likely shutting
+19 −0
Original line number Original line Diff line number Diff line
@@ -54,6 +54,8 @@ constexpr char kBtmLogTag[] = "SCAN";
constexpr uint16_t kAllowADTypeFilter = 0x80;
constexpr uint16_t kAllowADTypeFilter = 0x80;
constexpr uint8_t kFilterLogicOr = 0x00;
constexpr uint8_t kFilterLogicOr = 0x00;
constexpr uint8_t kLowestRssiValue = 129;
constexpr uint8_t kLowestRssiValue = 129;
constexpr uint16_t kAllowAllFilter = 0x00;
constexpr uint16_t kListLogicOr = 0x01;


class DefaultScanningCallback : public ::ScanningCallbacks {
class DefaultScanningCallback : public ::ScanningCallbacks {
  void OnScannerRegistered(const bluetooth::Uuid app_uuid, uint8_t scanner_id,
  void OnScannerRegistered(const bluetooth::Uuid app_uuid, uint8_t scanner_id,
@@ -749,3 +751,20 @@ void bluetooth::shim::set_ad_type_rsi_filter(bool enable) {
        bluetooth::hci::ApcfAction::ADD, 0x00, advertising_filter_parameter);
        bluetooth::hci::ApcfAction::ADD, 0x00, advertising_filter_parameter);
  }
  }
}
}

void bluetooth::shim::set_empty_filter(bool enable) {
  bluetooth::hci::AdvertisingFilterParameter advertising_filter_parameter;
  bluetooth::shim::GetScanning()->ScanFilterParameterSetup(
      bluetooth::hci::ApcfAction::DELETE, 0x00, advertising_filter_parameter);
  if (enable) {
    /* Add an allow-all filter on index 0 */
    advertising_filter_parameter.delivery_mode =
        bluetooth::hci::DeliveryMode::IMMEDIATE;
    advertising_filter_parameter.feature_selection = kAllowAllFilter;
    advertising_filter_parameter.list_logic_type = kListLogicOr;
    advertising_filter_parameter.filter_logic_type = kFilterLogicOr;
    advertising_filter_parameter.rssi_high_thresh = kLowestRssiValue;
    bluetooth::shim::GetScanning()->ScanFilterParameterSetup(
        bluetooth::hci::ApcfAction::ADD, 0x00, advertising_filter_parameter);
  }
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ namespace shim {
::BleScannerInterface* get_ble_scanner_instance();
::BleScannerInterface* get_ble_scanner_instance();
void init_scanning_manager();
void init_scanning_manager();
void set_ad_type_rsi_filter(bool enable);
void set_ad_type_rsi_filter(bool enable);
void set_empty_filter(bool enable);


}  // namespace shim
}  // namespace shim
}  // namespace bluetooth
}  // namespace bluetooth
+4 −0
Original line number Original line Diff line number Diff line
@@ -42,3 +42,7 @@ void bluetooth::shim::init_scanning_manager() {
void bluetooth::shim::set_ad_type_rsi_filter(bool enable) {
void bluetooth::shim::set_ad_type_rsi_filter(bool enable) {
  mock_function_count_map[__func__]++;
  mock_function_count_map[__func__]++;
}
}

void bluetooth::shim::set_empty_filter(bool enable) {
  mock_function_count_map[__func__]++;
}