diff options
author | Jakub Tyszkowski <jakub.tyszkowski@codecoup.pl> | 2022-04-01 14:03:16 +0000 |
---|---|---|
committer | Jakub Tyszkowski <jakub.tyszkowski@codecoup.pl> | 2022-04-05 14:16:59 +0000 |
commit | ab74e3e09143d2e009b6cbd243e61779e3a8d4b1 (patch) | |
tree | 90cf810518b87e46412374a380179925cfc34520 /framework/java/android/bluetooth/BluetoothHapClient.java | |
parent | c1a968aa24bb8f938d3ef25cd935701b392064a8 (diff) |
hap: Fix missing null device checks
Bug: 150670922
Tag: #feature
Test: atest BluetoothHapClientTest
Sponsor: jpawlowski@
Change-Id: Ia0e0d7b8892f202a8b3bef01dab0f64ff09a0c51
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothHapClient.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothHapClient.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHapClient.java b/framework/java/android/bluetooth/BluetoothHapClient.java index 5416d73610..1d51670ffe 100644 --- a/framework/java/android/bluetooth/BluetoothHapClient.java +++ b/framework/java/android/bluetooth/BluetoothHapClient.java @@ -644,6 +644,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable public boolean setConnectionPolicy(@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) { if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")"); + Objects.requireNonNull(device, "BluetoothDevice cannot be null"); final IBluetoothHapClient service = getService(); final boolean defaultValue = false; if (service == null) { @@ -673,7 +674,8 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable * {@link #CONNECTION_POLICY_UNKNOWN} * * @param device Bluetooth device - * @return connection policy of the device + * @return connection policy of the device or {@link #CONNECTION_POLICY_FORBIDDEN} if device is + * null * @hide */ @SystemApi |