summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothHeadset.java
diff options
context:
space:
mode:
authorRahul Sabnis <rahulsabnis@google.com>2022-03-18 18:17:21 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-18 18:17:21 +0000
commitbd0b4024ed48324a39c08dfa30c94366e71042c6 (patch)
tree09da7a160b884d65dbcfa1fb7b16fa92319bbf21 /framework/java/android/bluetooth/BluetoothHeadset.java
parent2465e1d738bc16cc2704924843d1fa6faf635862 (diff)
parent43c5b15e417d41b1fcc3cc2411e48922f8dd8742 (diff)
Merge "BluetoothHeadset#getAudioState now throws a NullPointerException if the device param is null." am: d2ef8d7c4f am: 802f6def78 am: 43c5b15e41
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2030694 Change-Id: I71761f63d211838f09f30c043431d63083f3a3f8
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothHeadset.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothHeadset.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHeadset.java b/framework/java/android/bluetooth/BluetoothHeadset.java
index c8d0a50eee..a430a0235d 100644
--- a/framework/java/android/bluetooth/BluetoothHeadset.java
+++ b/framework/java/android/bluetooth/BluetoothHeadset.java
@@ -49,6 +49,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.TimeoutException;
/**
@@ -904,7 +905,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
*
* @param device is the Bluetooth device for which the audio state is being queried
* @return the audio state of the device or an error code
- * @throws IllegalArgumentException if the device is null
+ * @throws NullPointerException if the device is null
*
* @hide
*/
@@ -916,9 +917,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
})
public @GetAudioStateReturnValues int getAudioState(@NonNull BluetoothDevice device) {
if (VDBG) log("getAudioState");
- if (device == null) {
- throw new IllegalArgumentException("device cannot be null");
- }
+ Objects.requireNonNull(device);
final IBluetoothHeadset service = mService;
final int defaultValue = BluetoothHeadset.STATE_AUDIO_DISCONNECTED;
if (service == null) {