Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2763ecd5 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "LeScanner: null check of BluetoothGatt" into main

parents ccc73004 b84b35e5
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -323,9 +323,12 @@ public final class BluetoothLeScanner {
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN)
    public void stopScan(PendingIntent callbackIntent) {
        BluetoothLeUtils.checkAdapterStateOn(mBluetoothAdapter);
        IBluetoothGatt gatt;
        try {
            gatt = mBluetoothAdapter.getBluetoothGatt();
            IBluetoothGatt gatt = mBluetoothAdapter.getBluetoothGatt();
            if (gatt == null) {
                Log.w(TAG, "stopScan called after bluetooth has been turned off");
                return;
            }
            final SynchronousResultReceiver recv = SynchronousResultReceiver.get();
            gatt.stopScanForIntent(callbackIntent, mAttributionSource, recv);
            recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null);