Skip to content
Merged
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
Bugfix: invoking value callback using Handler
  • Loading branch information
philips77 committed Sep 11, 2024
commit 03721ddb33fd6b7496518ddac421f40f55b54766
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.bluetooth.BluetoothDevice;
import android.os.Build;
import android.os.Handler;
import android.util.Log;

import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
Expand Down Expand Up @@ -191,8 +192,14 @@ void notifyConnectionPriorityChanged(@NonNull final BluetoothDevice device,
@IntRange(from = 6, to = 3200) final int interval,
@IntRange(from = 0, to = 499) final int latency,
@IntRange(from = 10, to = 3200) final int timeout) {
if (valueCallback != null)
valueCallback.onConnectionUpdated(device, interval, latency, timeout);
handler.post(() -> {
if (valueCallback != null)
try {
valueCallback.onConnectionUpdated(device, interval, latency, timeout);
} catch (final Throwable t) {
Log.e(TAG, "Exception in Value callback", t);
}
});
}

@ConnectionPriority
Expand Down