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

Commit c6c2a78a authored by Charles Lin's avatar Charles Lin
Browse files

Clear LE cache before starting le scan or the report is skipped

Test: Enable LE scan
Bug: 146474336
Change-Id: I4cd8217c1fd4860ed8bee49d55147ca00aa837ff
parent 11f37fb4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ class AdvertisingCache {
    }
  }

  void ClearAll() {
    items.clear();
  }

 private:
  struct Item {
    uint8_t addr_type;
@@ -447,6 +451,7 @@ tBTM_STATUS BTM_BleObserve(bool start, uint8_t duration,
    /* scan is not started */
    if (!BTM_BLE_IS_SCAN_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
      /* allow config of scan type */
      cache.ClearAll();
      p_inq->scan_type = (p_inq->scan_type == BTM_BLE_SCAN_MODE_NONE)
                             ? BTM_BLE_SCAN_MODE_ACTI
                             : p_inq->scan_type;
@@ -1297,6 +1302,7 @@ tBTM_STATUS btm_ble_start_inquiry(uint8_t mode, uint8_t duration) {
  }

  if (!BTM_BLE_IS_SCAN_ACTIVE(p_ble_cb->scan_activity)) {
    cache.ClearAll();
    btm_send_hci_set_scan_params(
        BTM_BLE_SCAN_MODE_ACTI, BTM_BLE_LOW_LATENCY_SCAN_INT,
        BTM_BLE_LOW_LATENCY_SCAN_WIN,
@@ -1986,6 +1992,7 @@ void btm_ble_process_adv_pkt_cont(uint16_t evt_type, uint8_t addr_type,
      update = false;
    } else {
      /* if yes, skip it */
      cache.Clear(addr_type, bda);
      return; /* assumption: one result per event */
    }
  }