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

Commit 39c46789 authored by Ugo Yu's avatar Ugo Yu Committed by William Escande
Browse files

Only report connectable devices when inquiry

Drop all non-connectable BLE beacons to reduce the spam in the
settings' scanning page.

Bug: 219387005
Bug: 263323082
Test: manual
Change-Id: I6193498b06253256e39bd26dfc3db15fd01e28b9
(cherry picked from commit 1f7ef99de59406a1a2fc0ce14631df64249b35e2)
parent 3d803ead
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1913,6 +1913,8 @@ static void bta_dm_inq_results_cb(tBTM_INQ_RESULTS* p_inq, const uint8_t* p_eir,
  result.inq_res.p_eir = const_cast<uint8_t*>(p_eir);
  result.inq_res.eir_len = eir_len;

  result.inq_res.ble_evt_type = p_inq->ble_evt_type;

  p_inq_info = BTM_InqDbRead(p_inq->remote_bd_addr);
  if (p_inq_info != NULL) {
    /* initialize remt_name_not_required to false so that we get the name by
+11 −0
Original line number Diff line number Diff line
@@ -1399,6 +1399,17 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event,
        status = btif_storage_set_remote_addr_type(&bdaddr, addr_type);
        ASSERTC(status == BT_STATUS_SUCCESS,
                "failed to save remote addr type (inquiry)", status);

        bool restrict_report = osi_property_get_bool(
            "bluetooth.restrict_discovered_device.enabled", false);
        if (restrict_report &&
            p_search_data->inq_res.device_type == BT_DEVICE_TYPE_BLE &&
            !(p_search_data->inq_res.ble_evt_type & BTM_BLE_CONNECTABLE_MASK)) {
          LOG_INFO("%s: Ble device is not connectable",
                   ADDRESS_TO_LOGGABLE_CSTR(bdaddr));
          break;
        }

        /* Callback to notify upper layer of device */
        GetInterfaceToProfiles()->events->invoke_device_found_cb(num_properties,
                                                                 properties);