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

Commit 1bad855b authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Android (Google) Code Review
Browse files

Merge "Update BluetoothAdapter#setScanMode to throw an...

Merge "Update BluetoothAdapter#setScanMode to throw an IllegalArgumentException when the the input is invalid" into tm-dev
parents 65b8a670 d8e063f2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1941,6 +1941,7 @@ public final class BluetoothAdapter {
     * @param mode represents the desired state of the local device scan mode
     *
     * @return status code indicating whether the scan mode was successfully set
     * @throws IllegalArgumentException if the mode is not a valid scan mode
     * @hide
     */
    @SystemApi
@@ -1954,6 +1955,10 @@ public final class BluetoothAdapter {
        if (getState() != STATE_ON) {
            return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
        }
        if (mode != SCAN_MODE_NONE && mode != SCAN_MODE_CONNECTABLE
                && mode != SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
            throw new IllegalArgumentException("Invalid scan mode param value");
        }
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {