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

Commit 1e89d2a2 authored by Wei Wang's avatar Wei Wang
Browse files

only stop ble scan when it's already started.

Change-Id: I3068254c576e8735ffb47d89f4bb8d5a719891c9
parent c0e9887e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1242,6 +1242,7 @@ public class GattService extends ProfileService {
        // TODO: use settings to configure scan params.
        // TODO: move logic to state machine to avoid locking.
        synchronized(mScanQueue) {
            boolean isScaning = (!mScanQueue.isEmpty());
            if (getScanClient(appIf, isServer) == null) {
                if (DBG) Log.d(TAG, "startScan() - adding client=" + appIf);
                mScanQueue.add(new ScanClient(appIf, isServer, settings, filters));
@@ -1250,7 +1251,9 @@ public class GattService extends ProfileService {
            if (!Objects.deepEquals(newFilters, mScanFilters)) {
                mScanFilters = newFilters;
                // Restart scan using new filters.
                if (isScaning) {
                    sendStopScanMessage();
                }
                sendStartScanMessage(mScanFilters);
            }
        }