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

Commit 3492fd1a authored by Martin Brabham's avatar Martin Brabham Committed by Myles Watson
Browse files

Allow null scan filters as some existing use cases require them.

Bug: 188630254
Test: atest CtsBluetoothTestCases:android.bluetooth.cts.BluetoothLeScanTest#testBasicBleScan -- --abi arm64-v8a
Tag: #feature
Change-Id: I101bc47c2dec6b06f02622bb9db568fe74db8498
parent bf6dede3
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@@ -3281,7 +3280,8 @@ public class GattService extends ProfileService {
        if (DBG) {
            Log.d(TAG, "enforcePrivilegedPermissionIfNeeded(" + filters + ")");
        }
        Objects.requireNonNull(filters, "'filters' must not be null!");
        // Some 3p API cases may have null filters, need to allow
        if (filters != null) {
            for (ScanFilter filter : filters) {
                if (filter.getDeviceAddress() != null && filter.getAddressType()
                        == BluetoothDevice.ADDRESS_TYPE_PUBLIC && filter.getIrk() == null) {
@@ -3290,6 +3290,7 @@ public class GattService extends ProfileService {
                }
            }
        }
    }

    // Enforce caller has BLUETOOTH_PRIVILEGED permission. A {@link SecurityException} will be
    // thrown if the caller app does not have BLUETOOTH_PRIVILEGED permission.