From fb70a07f643a01992b315be24e9c2a271642df75 Mon Sep 17 00:00:00 2001 From: TaaviE Date: Sun, 2 Aug 2020 23:59:42 +0300 Subject: [PATCH] Tried fixing a LineageOS quirk with regular BT scans --- .../gadgetbridge/activities/DiscoveryActivity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java index e968ed384..88058739a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java @@ -623,7 +623,12 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView */ private void startBTDiscovery(Scanning what) { LOG.info("Starting BT discovery"); - + try { + // LineageOS quirk, can't start scan properly, + // if scan has been started by something else + stopBTDiscovery(); + } catch (Exception ignored) { + } handler.removeMessages(0, stopRunnable); handler.sendMessageDelayed(getPostMessage(stopRunnable), SCAN_DURATION); if (adapter.startDiscovery()) {