Skip to content

Commit 1a9fd9e

Browse files
committed
Warnings fixed
1 parent d4b1ef4 commit 1a9fd9e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ private boolean internalConnect(@NonNull final BluetoothDevice device,
779779
return true;
780780
}
781781

782-
private boolean internalDisconnect(final int reason) {
782+
private void internalDisconnect(final int reason) {
783783
userDisconnected = true;
784784
initialConnection = false;
785785
ready = false;
@@ -825,7 +825,6 @@ private boolean internalDisconnect(final int reason) {
825825
r.notifyInvalidRequest();
826826
}
827827
nextRequest(true);
828-
return true;
829828
}
830829

831830
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
@@ -3589,6 +3588,10 @@ private synchronized void nextRequest(final boolean force) {
35893588
}
35903589
}
35913590

3591+
// At this point the bluetoothDevice is either null, and the request is a ConnectRequest,
3592+
// or not a null.
3593+
assert bluetoothDevice != null || request.type == Request.Type.CONNECT;
3594+
35923595
switch (request.type) {
35933596
case CONNECT: {
35943597
//noinspection DataFlowIssue
@@ -3599,7 +3602,10 @@ private synchronized void nextRequest(final boolean force) {
35993602
break;
36003603
}
36013604
case DISCONNECT: {
3602-
result = internalDisconnect(ConnectionObserver.REASON_SUCCESS);
3605+
internalDisconnect(ConnectionObserver.REASON_SUCCESS);
3606+
// If a disconnect request failed, it has already been notified at this point,
3607+
// therefore result is a success (true).
3608+
result = true;
36033609
break;
36043610
}
36053611
case ENSURE_BOND: {

0 commit comments

Comments
 (0)