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

Commit 5d12e5e8 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Protect concurrent access to local state used during BLE scanning am: e1462884 am: 89e1b5df

am: 7ddea676

Change-Id: I9c21c468416cf5bb68db3ba25e3ff83015507942
parents c3e2c4eb 7ddea676
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ struct equal_to<bt_bdaddr_t> {

namespace {

// all access to this variable should be done on the jni thread
std::unordered_set<bt_bdaddr_t> p_dev_cb;

void btif_gattc_add_remote_bdaddr(BD_ADDR p_bda, uint8_t addr_type) {
@@ -258,8 +259,11 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
  }

  void Scan(bool start) override {
    do_in_jni_thread(Bind(
        [](bool start) {
          if (!start) {
      do_in_bta_thread(FROM_HERE, Bind(&BTA_DmBleObserve, false, 0, nullptr));
            do_in_bta_thread(FROM_HERE,
                             Bind(&BTA_DmBleObserve, false, 0, nullptr));
            return;
          }

@@ -267,6 +271,8 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
          do_in_bta_thread(FROM_HERE,
                           Bind(&BTA_DmBleObserve, true, 0,
                                (tBTA_DM_SEARCH_CBACK*)bta_scan_results_cb));
        },
        start));
  }

  void ScanFilterParamSetup(