Skip to content

Commit 8e5e1d2

Browse files
Grega Podlesekmuscardinus
authored andcommitted
To be consistent, don't report "Connecting" state when connecting with autoConect == true
1 parent 168c6a8 commit 8e5e1d2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ble/src/main/java/no/nordicsemi/android/ble/BleManagerHandler.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,10 +706,12 @@ private boolean internalConnect(@NonNull final BluetoothDevice device,
706706
userDisconnected = !shouldAutoConnect;
707707

708708
bluetoothDevice = device;
709-
log(Log.VERBOSE, () -> connectRequest.isFirstAttempt() ? "Connecting..." : "Retrying...");
710-
connectionState = BluetoothGatt.STATE_CONNECTING;
711-
postCallback(c -> c.onDeviceConnecting(device));
712-
postConnectionStateChange(o -> o.onDeviceConnecting(device));
709+
if (!autoConnect) {
710+
log(Log.VERBOSE, () -> connectRequest.isFirstAttempt() ? "Connecting..." : "Retrying...");
711+
connectionState = BluetoothGatt.STATE_CONNECTING;
712+
postCallback(c -> c.onDeviceConnecting(device));
713+
postConnectionStateChange(o -> o.onDeviceConnecting(device));
714+
}
713715
connectionTime = SystemClock.elapsedRealtime();
714716
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
715717
// connectRequest will never be null here.

0 commit comments

Comments
 (0)