Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,14 @@ public void run() {
while (true) {
try {
bytesRead = mmInStream.read(buffer);
// API-37 changes the read value to -1 when connection is dropped.
// See https://developer.android.com/about/versions/17/behavior-changes-17#bluetooth-rfcomm-socket-change for details.
// We need to handle this case to break the loop.
if (bytesRead == -1) {
DebugTool.logInfo(TAG, "bytesRead returns -1...dealing with connection lost");
connectionLost();
break;
}
// Log.i(getClass().getName(), "Received " + bytesRead + " bytes from Bluetooth");
for (int i = 0; i < bytesRead; i++) {
input = buffer[i];
Expand Down
Loading