diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java index 1546b8302..36b6d2a80 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java @@ -265,9 +265,6 @@ public final class BtLEQueue { mGbDevice.setState(newState); mGbDevice.sendDeviceUpdateIntent(mContext); - if (mConnectionLatch != null && newState == State.CONNECTED) { - mConnectionLatch.countDown(); - } } public void disconnect() { @@ -516,6 +513,9 @@ public final class BtLEQueue { // only propagate the successful event getCallbackToUse().onServicesDiscovered(gatt); } + if (mConnectionLatch != null) { + mConnectionLatch.countDown(); + } } else { LOG.warn("onServicesDiscovered received: " + status); }