diff options
Diffstat (limited to 'framework/java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothAdapter.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java index 4e950e31f8..04232f6cf0 100644 --- a/framework/java/android/bluetooth/BluetoothAdapter.java +++ b/framework/java/android/bluetooth/BluetoothAdapter.java @@ -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) { |