Skip to content

Commit

Permalink
Merge pull request #581
Browse files Browse the repository at this point in the history
Warnings fixed
  • Loading branch information
philips77 authored Aug 29, 2024
2 parents d4b1ef4 + 1a9fd9e commit 302a56f
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ private boolean internalConnect(@NonNull final BluetoothDevice device,
return true;
}

private boolean internalDisconnect(final int reason) {
private void internalDisconnect(final int reason) {
userDisconnected = true;
initialConnection = false;
ready = false;
Expand Down Expand Up @@ -825,7 +825,6 @@ private boolean internalDisconnect(final int reason) {
r.notifyInvalidRequest();
}
nextRequest(true);
return true;
}

@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
Expand Down Expand Up @@ -3589,6 +3588,10 @@ private synchronized void nextRequest(final boolean force) {
}
}

// At this point the bluetoothDevice is either null, and the request is a ConnectRequest,
// or not a null.
assert bluetoothDevice != null || request.type == Request.Type.CONNECT;

switch (request.type) {
case CONNECT: {
//noinspection DataFlowIssue
Expand All @@ -3599,7 +3602,10 @@ private synchronized void nextRequest(final boolean force) {
break;
}
case DISCONNECT: {
result = internalDisconnect(ConnectionObserver.REASON_SUCCESS);
internalDisconnect(ConnectionObserver.REASON_SUCCESS);
// If a disconnect request failed, it has already been notified at this point,
// therefore result is a success (true).
result = true;
break;
}
case ENSURE_BOND: {
Expand Down

0 comments on commit 302a56f

Please sign in to comment.