summaryrefslogtreecommitdiff
path: root/framework/java
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-02-18 11:37:11 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-02-18 11:37:11 -0800
commitded069fbba0821df68691de05f2d9c7cf56b9723 (patch)
tree8ad809fd75a1032450cefe291f1c855f1ac68bc0 /framework/java
parentb72c184c30c2c0698c43fcd0c411c5711a8af7f1 (diff)
parentfb24a5190276c8411664039c30de7d57ca04be6b (diff)
Merge "Standardize the usage of `requireNonNull` across the codebase." into main am: 33edf5d2d6 am: fb24a51902
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/3496931 Change-Id: Iea4c5ea1789fc702701567ff7c1ad6660d4744d6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'framework/java')
-rw-r--r--framework/java/android/bluetooth/BluetoothAdapter.java10
-rw-r--r--framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java9
-rw-r--r--framework/java/android/bluetooth/BluetoothHeadset.java5
-rw-r--r--framework/java/android/bluetooth/BluetoothHidHost.java10
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcast.java17
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java35
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastChannel.java6
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java8
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastReceiveState.java9
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastSettings.java4
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java12
-rw-r--r--framework/java/android/bluetooth/BluetoothLeBroadcastSubgroupSettings.java6
-rw-r--r--framework/java/android/bluetooth/BluetoothPan.java7
-rw-r--r--framework/java/android/bluetooth/BluetoothQualityReport.java5
-rw-r--r--framework/java/android/bluetooth/BluetoothSap.java7
-rw-r--r--framework/java/android/bluetooth/le/AdvertisingSet.java2
-rw-r--r--framework/java/android/bluetooth/le/AdvertisingSetParameters.java5
-rw-r--r--framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java5
-rw-r--r--framework/java/android/bluetooth/le/BluetoothLeScanner.java5
-rw-r--r--framework/java/android/bluetooth/le/DistanceMeasurementManager.java13
-rw-r--r--framework/java/android/bluetooth/le/DistanceMeasurementParams.java7
-rw-r--r--framework/java/android/bluetooth/le/PeriodicAdvertisingManager.java5
-rw-r--r--framework/java/android/bluetooth/le/TransportBlockFilter.java8
23 files changed, 112 insertions, 88 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index 08f880e04a..3fcda779e6 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -2748,8 +2748,8 @@ public final class BluetoothAdapter {
public void requestControllerActivityEnergyInfo(
@NonNull @CallbackExecutor Executor executor,
@NonNull OnBluetoothActivityEnergyInfoCallback callback) {
- requireNonNull(executor, "executor cannot be null");
- requireNonNull(callback, "callback cannot be null");
+ requireNonNull(executor);
+ requireNonNull(callback);
OnBluetoothActivityEnergyInfoProxy proxy =
new OnBluetoothActivityEnergyInfoProxy(executor, callback);
mServiceLock.readLock().lock();
@@ -3790,7 +3790,7 @@ public final class BluetoothAdapter {
@SuppressLint("AndroidFrameworkRequiresPermission") // Internal callback
@RequiresNoPermission
public void onBluetoothServiceUp(@NonNull IBinder bluetoothService) {
- requireNonNull(bluetoothService, "bluetoothService cannot be null");
+ requireNonNull(bluetoothService);
mServiceLock.writeLock().lock();
try {
mService = IBluetooth.Stub.asInterface(bluetoothService);
@@ -5164,7 +5164,7 @@ public final class BluetoothAdapter {
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @NonNull Bundle getPreferredAudioProfiles(@NonNull BluetoothDevice device) {
if (DBG) Log.d(TAG, "getPreferredAudioProfiles(" + device + ")");
- requireNonNull(device, "device cannot be null");
+ requireNonNull(device);
if (!BluetoothAdapter.checkBluetoothAddress(device.getAddress())) {
throw new IllegalArgumentException("device cannot have an invalid address");
}
@@ -5218,7 +5218,7 @@ public final class BluetoothAdapter {
@NotifyActiveDeviceChangeAppliedReturnValues
public int notifyActiveDeviceChangeApplied(@NonNull BluetoothDevice device) {
if (DBG) Log.d(TAG, "notifyActiveDeviceChangeApplied(" + device + ")");
- requireNonNull(device, "device cannot be null");
+ requireNonNull(device);
if (!BluetoothAdapter.checkBluetoothAddress(device.getAddress())) {
throw new IllegalArgumentException("device cannot have an invalid address");
}
diff --git a/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java b/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java
index 7ea5a520c9..44d7b29465 100644
--- a/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java
+++ b/framework/java/android/bluetooth/BluetoothCsipSetCoordinator.java
@@ -21,6 +21,8 @@ import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
import static android.bluetooth.BluetoothUtils.executeFromBinder;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -46,7 +48,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.Executor;
@@ -283,8 +284,8 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
@NonNull @CallbackExecutor Executor executor,
@NonNull ClientLockCallback callback) {
if (VDBG) log("lockGroup()");
- Objects.requireNonNull(executor, "executor cannot be null");
- Objects.requireNonNull(callback, "callback cannot be null");
+ requireNonNull(executor);
+ requireNonNull(callback);
final IBluetoothCsipSetCoordinator service = getService();
if (service == null) {
Log.w(TAG, "Proxy not attached to service");
@@ -315,7 +316,7 @@ public final class BluetoothCsipSetCoordinator implements BluetoothProfile, Auto
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public boolean unlockGroup(@NonNull UUID lockUuid) {
if (VDBG) log("unlockGroup()");
- Objects.requireNonNull(lockUuid, "lockUuid cannot be null");
+ requireNonNull(lockUuid);
final IBluetoothCsipSetCoordinator service = getService();
if (service == null) {
Log.w(TAG, "Proxy not attached to service");
diff --git a/framework/java/android/bluetooth/BluetoothHeadset.java b/framework/java/android/bluetooth/BluetoothHeadset.java
index 247d639264..188a78e0d8 100644
--- a/framework/java/android/bluetooth/BluetoothHeadset.java
+++ b/framework/java/android/bluetooth/BluetoothHeadset.java
@@ -20,6 +20,8 @@ import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
import static android.Manifest.permission.MODIFY_PHONE_STATE;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -44,7 +46,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collections;
import java.util.List;
-import java.util.Objects;
/**
* Public API for controlling the Bluetooth Headset Service. This includes both Bluetooth Headset
@@ -805,7 +806,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
})
public @GetAudioStateReturnValues int getAudioState(@NonNull BluetoothDevice device) {
if (VDBG) log("getAudioState");
- Objects.requireNonNull(device);
+ requireNonNull(device);
final IBluetoothHeadset service = getService();
if (service == null) {
Log.w(TAG, "Proxy not attached to service");
diff --git a/framework/java/android/bluetooth/BluetoothHidHost.java b/framework/java/android/bluetooth/BluetoothHidHost.java
index b1e4de56a0..123590a148 100644
--- a/framework/java/android/bluetooth/BluetoothHidHost.java
+++ b/framework/java/android/bluetooth/BluetoothHidHost.java
@@ -19,7 +19,8 @@ package android.bluetooth;
import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
-import android.annotation.FlaggedApi;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.NonNull;
import android.annotation.RequiresNoPermission;
import android.annotation.RequiresPermission;
@@ -37,11 +38,8 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
-import com.android.bluetooth.flags.Flags;
-
import java.util.Collections;
import java.util.List;
-import java.util.Objects;
/**
* This class provides the public APIs to control the Bluetooth Input Device Profile.
@@ -476,7 +474,7 @@ public final class BluetoothHidHost implements BluetoothProfile {
@NonNull BluetoothDevice device, @Transport int transport) {
if (DBG) log("setPreferredTransport(" + device + ", " + transport + ")");
- Objects.requireNonNull(device, "device must not be null");
+ requireNonNull(device);
if (transport != BluetoothDevice.TRANSPORT_AUTO
&& transport != BluetoothDevice.TRANSPORT_BREDR
@@ -578,7 +576,7 @@ public final class BluetoothHidHost implements BluetoothProfile {
public @Transport int getPreferredTransport(@NonNull BluetoothDevice device) {
if (VDBG) log("getPreferredTransport(" + device + ")");
- Objects.requireNonNull(device, "device must not be null");
+ requireNonNull(device);
final IBluetoothHidHost service = getService();
if (service == null) {
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcast.java b/framework/java/android/bluetooth/BluetoothLeBroadcast.java
index 88b6174f1c..7ebc5cb82e 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcast.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcast.java
@@ -19,6 +19,8 @@ package android.bluetooth;
import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -41,7 +43,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import java.util.concurrent.Executor;
/**
@@ -361,8 +362,8 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void registerCallback(
@NonNull @CallbackExecutor Executor executor, @NonNull Callback callback) {
- Objects.requireNonNull(executor, "executor cannot be null");
- Objects.requireNonNull(callback, "callback cannot be null");
+ requireNonNull(executor);
+ requireNonNull(callback);
if (DBG) log("registerCallback");
@@ -411,7 +412,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
@RequiresBluetoothConnectPermission
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void unregisterCallback(@NonNull Callback callback) {
- Objects.requireNonNull(callback, "callback cannot be null");
+ requireNonNull(callback);
if (DBG) log("unregisterCallback");
@@ -479,7 +480,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
public void startBroadcast(
@NonNull BluetoothLeAudioContentMetadata contentMetadata,
@Nullable byte[] broadcastCode) {
- Objects.requireNonNull(contentMetadata, "contentMetadata cannot be null");
+ requireNonNull(contentMetadata);
if (mCallbackExecutorMap.isEmpty()) {
throw new IllegalStateException("No callback was ever registered");
}
@@ -512,7 +513,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
@RequiresBluetoothConnectPermission
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void startBroadcast(@NonNull BluetoothLeBroadcastSettings broadcastSettings) {
- Objects.requireNonNull(broadcastSettings, "broadcastSettings cannot be null");
+ requireNonNull(broadcastSettings);
if (mCallbackExecutorMap.isEmpty()) {
throw new IllegalStateException("No callback was ever registered");
}
@@ -549,7 +550,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void updateBroadcast(
int broadcastId, @NonNull BluetoothLeAudioContentMetadata contentMetadata) {
- Objects.requireNonNull(contentMetadata, "contentMetadata cannot be null");
+ requireNonNull(contentMetadata);
if (mCallbackExecutorMap.isEmpty()) {
throw new IllegalStateException("No callback was ever registered");
}
@@ -589,7 +590,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void updateBroadcast(
int broadcastId, @NonNull BluetoothLeBroadcastSettings broadcastSettings) {
- Objects.requireNonNull(broadcastSettings, "broadcastSettings cannot be null");
+ requireNonNull(broadcastSettings);
if (mCallbackExecutorMap.isEmpty()) {
throw new IllegalStateException("No callback was ever registered");
}
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java b/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java
index d8a5b4080e..f789bf73d4 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java
@@ -20,6 +20,8 @@ import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
import static android.Manifest.permission.BLUETOOTH_SCAN;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.CallbackExecutor;
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
@@ -50,7 +52,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import java.util.concurrent.Executor;
/**
@@ -578,7 +579,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@Override
public @BluetoothProfile.BtProfileState int getConnectionState(@NonNull BluetoothDevice sink) {
log("getConnectionState(" + sink + ")");
- Objects.requireNonNull(sink, "sink cannot be null");
+ requireNonNull(sink);
final IBluetoothLeBroadcastAssistant service = getService();
final int defaultValue = BluetoothProfile.STATE_DISCONNECTED;
if (service == null) {
@@ -606,7 +607,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@NonNull
public List<BluetoothDevice> getDevicesMatchingConnectionStates(@NonNull int[] states) {
log("getDevicesMatchingConnectionStates()");
- Objects.requireNonNull(states, "states cannot be null");
+ requireNonNull(states);
final IBluetoothLeBroadcastAssistant service = getService();
final List<BluetoothDevice> defaultValue = new ArrayList<BluetoothDevice>();
if (service == null) {
@@ -667,7 +668,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
public boolean setConnectionPolicy(
@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) {
log("setConnectionPolicy()");
- Objects.requireNonNull(device, "device cannot be null");
+ requireNonNull(device);
final IBluetoothLeBroadcastAssistant service = getService();
final boolean defaultValue = false;
if (service == null) {
@@ -702,7 +703,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
log("getConnectionPolicy()");
- Objects.requireNonNull(device, "device cannot be null");
+ requireNonNull(device);
final IBluetoothLeBroadcastAssistant service = getService();
final int defaultValue = BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
if (service == null) {
@@ -737,8 +738,8 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void registerCallback(
@NonNull @CallbackExecutor Executor executor, @NonNull Callback callback) {
- Objects.requireNonNull(executor, "executor cannot be null");
- Objects.requireNonNull(callback, "callback cannot be null");
+ requireNonNull(executor);
+ requireNonNull(callback);
log("registerCallback");
synchronized (mCallbackExecutorMap) {
@@ -786,7 +787,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@RequiresBluetoothConnectPermission
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void unregisterCallback(@NonNull Callback callback) {
- Objects.requireNonNull(callback, "callback cannot be null");
+ requireNonNull(callback);
log("unregisterCallback");
synchronized (mCallbackExecutorMap) {
@@ -844,7 +845,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@RequiresPermission(allOf = {BLUETOOTH_SCAN, BLUETOOTH_PRIVILEGED})
public void startSearchingForSources(@NonNull List<ScanFilter> filters) {
log("searchForBroadcastSources");
- Objects.requireNonNull(filters, "filters can be empty, but not null");
+ requireNonNull(filters);
if (mCallback == null) {
throw new IllegalStateException("No callback was ever registered");
}
@@ -997,8 +998,8 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@NonNull BluetoothLeBroadcastMetadata sourceMetadata,
boolean isGroupOp) {
log("addBroadcastSource: " + sourceMetadata + " on " + sink);
- Objects.requireNonNull(sink, "sink cannot be null");
- Objects.requireNonNull(sourceMetadata, "sourceMetadata cannot be null");
+ requireNonNull(sink);
+ requireNonNull(sourceMetadata);
if (mCallback == null) {
throw new IllegalStateException("No callback was ever registered");
}
@@ -1073,8 +1074,8 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
int sourceId,
@NonNull BluetoothLeBroadcastMetadata updatedMetadata) {
log("updateBroadcastSource: " + updatedMetadata + " on " + sink);
- Objects.requireNonNull(sink, "sink cannot be null");
- Objects.requireNonNull(updatedMetadata, "updatedMetadata cannot be null");
+ requireNonNull(sink);
+ requireNonNull(updatedMetadata);
if (mCallback == null) {
throw new IllegalStateException("No callback was ever registered");
}
@@ -1125,7 +1126,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public void removeSource(@NonNull BluetoothDevice sink, int sourceId) {
log("removeBroadcastSource: " + sourceId + " from " + sink);
- Objects.requireNonNull(sink, "sink cannot be null");
+ requireNonNull(sink);
if (mCallback == null) {
throw new IllegalStateException("No callback was ever registered");
}
@@ -1164,7 +1165,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@NonNull
public List<BluetoothLeBroadcastReceiveState> getAllSources(@NonNull BluetoothDevice sink) {
log("getAllSources()");
- Objects.requireNonNull(sink, "sink cannot be null");
+ requireNonNull(sink);
final IBluetoothLeBroadcastAssistant service = getService();
final List<BluetoothLeBroadcastReceiveState> defaultValue =
new ArrayList<BluetoothLeBroadcastReceiveState>();
@@ -1193,7 +1194,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
@RequiresBluetoothConnectPermission
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public int getMaximumSourceCapacity(@NonNull BluetoothDevice sink) {
- Objects.requireNonNull(sink, "sink cannot be null");
+ requireNonNull(sink);
final IBluetoothLeBroadcastAssistant service = getService();
final int defaultValue = 0;
if (service == null) {
@@ -1236,7 +1237,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au
public @Nullable BluetoothLeBroadcastMetadata getSourceMetadata(
@NonNull BluetoothDevice sink, @IntRange(from = 0x00, to = 0xFF) int sourceId) {
log("getSourceMetadata()");
- Objects.requireNonNull(sink, "sink cannot be null");
+ requireNonNull(sink);
if (sourceId < 0x00 || sourceId > 0xFF) {
throw new IllegalArgumentException(
"sourceId " + sourceId + " does not fall between 0x00 and 0xFF");
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastChannel.java b/framework/java/android/bluetooth/BluetoothLeBroadcastChannel.java
index 9960183880..5149b19211 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastChannel.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastChannel.java
@@ -16,6 +16,8 @@
package android.bluetooth;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
@@ -230,7 +232,7 @@ public final class BluetoothLeBroadcastChannel implements Parcelable {
@NonNull
public Builder setCodecMetadata(
@NonNull BluetoothLeAudioCodecConfigMetadata codecMetadata) {
- Objects.requireNonNull(codecMetadata, "codecMetadata cannot be null");
+ requireNonNull(codecMetadata);
mCodecMetadata = codecMetadata;
return this;
}
@@ -245,7 +247,7 @@ public final class BluetoothLeBroadcastChannel implements Parcelable {
*/
@SystemApi
public @NonNull BluetoothLeBroadcastChannel build() {
- Objects.requireNonNull(mCodecMetadata, "codec metadata cannot be null");
+ requireNonNull(mCodecMetadata);
if (mChannelIndex == UNKNOWN_VALUE_PLACEHOLDER) {
throw new IllegalArgumentException(
"mChannelIndex cannot be " + UNKNOWN_VALUE_PLACEHOLDER);
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java b/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java
index 2e58a23c06..ea77d2684c 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java
@@ -16,6 +16,8 @@
package android.bluetooth;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
@@ -582,7 +584,7 @@ public final class BluetoothLeBroadcastMetadata implements Parcelable {
throw new IllegalArgumentException(
"sourceAddressType " + sourceAddressType + " is invalid");
}
- Objects.requireNonNull(sourceDevice, "sourceDevice cannot be null");
+ requireNonNull(sourceDevice);
mSourceAddressType = sourceAddressType;
mSourceDevice = sourceDevice;
return this;
@@ -785,7 +787,7 @@ public final class BluetoothLeBroadcastMetadata implements Parcelable {
*/
@SystemApi
public @NonNull Builder addSubgroup(@NonNull BluetoothLeBroadcastSubgroup subgroup) {
- Objects.requireNonNull(subgroup, "subgroup cannot be null");
+ requireNonNull(subgroup);
mSubgroups.add(subgroup);
return this;
}
@@ -821,7 +823,7 @@ public final class BluetoothLeBroadcastMetadata implements Parcelable {
throw new IllegalArgumentException(
"sourceAddressType " + mSourceAddressType + " is invalid");
}
- Objects.requireNonNull(mSourceDevice, "mSourceDevice cannot be null");
+ requireNonNull(mSourceDevice);
if (mSubgroups.isEmpty()) {
throw new IllegalArgumentException("Must contain at least one subgroup");
}
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastReceiveState.java b/framework/java/android/bluetooth/BluetoothLeBroadcastReceiveState.java
index bfa6741a99..3fa4dcc7a3 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastReceiveState.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastReceiveState.java
@@ -16,6 +16,8 @@
package android.bluetooth;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
@@ -28,7 +30,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
import java.util.List;
-import java.util.Objects;
/**
* The {@link BluetoothLeBroadcastReceiveState} is used by the BASS server to expose information
@@ -250,7 +251,7 @@ public final class BluetoothLeBroadcastReceiveState implements Parcelable {
throw new IllegalArgumentException(
"sourceId " + sourceId + " does not fall between 0x00 and 0xFF");
}
- Objects.requireNonNull(sourceDevice, "sourceDevice cannot be null");
+ requireNonNull(sourceDevice);
if (sourceAddressType == BluetoothDevice.ADDRESS_TYPE_UNKNOWN) {
throw new IllegalArgumentException("sourceAddressType cannot be ADDRESS_TYPE_UNKNOWN");
}
@@ -259,7 +260,7 @@ public final class BluetoothLeBroadcastReceiveState implements Parcelable {
throw new IllegalArgumentException(
"sourceAddressType " + sourceAddressType + " is invalid");
}
- Objects.requireNonNull(bisSyncState, "bisSyncState cannot be null");
+ requireNonNull(bisSyncState);
if (bisSyncState.size() != numSubgroups) {
throw new IllegalArgumentException(
"bisSyncState.size() "
@@ -267,7 +268,7 @@ public final class BluetoothLeBroadcastReceiveState implements Parcelable {
+ " must be equal to numSubgroups "
+ numSubgroups);
}
- Objects.requireNonNull(subgroupMetadata, "subgroupMetadata cannot be null");
+ requireNonNull(subgroupMetadata);
if (subgroupMetadata.size() != numSubgroups) {
throw new IllegalArgumentException(
"subgroupMetadata.size() "
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastSettings.java b/framework/java/android/bluetooth/BluetoothLeBroadcastSettings.java
index 1c2f7d3226..48d53c4cb3 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastSettings.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastSettings.java
@@ -16,6 +16,8 @@
package android.bluetooth;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
@@ -326,7 +328,7 @@ public final class BluetoothLeBroadcastSettings implements Parcelable {
@NonNull
public Builder addSubgroupSettings(
@NonNull BluetoothLeBroadcastSubgroupSettings subgroupSettings) {
- Objects.requireNonNull(subgroupSettings, "subgroupSettings cannot be null");
+ requireNonNull(subgroupSettings);
mSubgroupSettings.add(subgroupSettings);
return this;
}
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java b/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java
index b53a33bcfa..86580d5fe5 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroup.java
@@ -16,6 +16,8 @@
package android.bluetooth;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
@@ -264,7 +266,7 @@ public final class BluetoothLeBroadcastSubgroup implements Parcelable {
@NonNull
public Builder setCodecSpecificConfig(
@NonNull BluetoothLeAudioCodecConfigMetadata codecSpecificConfig) {
- Objects.requireNonNull(codecSpecificConfig, "codecSpecificConfig cannot be null");
+ requireNonNull(codecSpecificConfig);
mCodecSpecificConfig = codecSpecificConfig;
return this;
}
@@ -281,7 +283,7 @@ public final class BluetoothLeBroadcastSubgroup implements Parcelable {
@NonNull
public Builder setContentMetadata(
@NonNull BluetoothLeAudioContentMetadata contentMetadata) {
- Objects.requireNonNull(contentMetadata, "contentMetadata cannot be null");
+ requireNonNull(contentMetadata);
mContentMetadata = contentMetadata;
return this;
}
@@ -300,7 +302,7 @@ public final class BluetoothLeBroadcastSubgroup implements Parcelable {
*/
@SystemApi
public @NonNull Builder addChannel(@NonNull BluetoothLeBroadcastChannel channel) {
- Objects.requireNonNull(channel, "channel cannot be null");
+ requireNonNull(channel);
mChannels.add(channel);
return this;
}
@@ -328,8 +330,8 @@ public final class BluetoothLeBroadcastSubgroup implements Parcelable {
*/
@SystemApi
public @NonNull BluetoothLeBroadcastSubgroup build() {
- Objects.requireNonNull(mCodecSpecificConfig, "CodecSpecificConfig is null");
- Objects.requireNonNull(mContentMetadata, "ContentMetadata is null");
+ requireNonNull(mCodecSpecificConfig);
+ requireNonNull(mContentMetadata);
if (mChannels.isEmpty()) {
throw new IllegalArgumentException("Must have at least one channel");
}
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroupSettings.java b/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroupSettings.java
index 30e2a26dd4..d903435974 100644
--- a/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroupSettings.java
+++ b/framework/java/android/bluetooth/BluetoothLeBroadcastSubgroupSettings.java
@@ -16,6 +16,8 @@
package android.bluetooth;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -211,7 +213,7 @@ public final class BluetoothLeBroadcastSubgroupSettings implements Parcelable {
@NonNull
public Builder setContentMetadata(
@NonNull BluetoothLeAudioContentMetadata contentMetadata) {
- Objects.requireNonNull(contentMetadata, "contentMetadata cannot be null");
+ requireNonNull(contentMetadata);
mContentMetadata = contentMetadata;
return this;
}
@@ -227,7 +229,7 @@ public final class BluetoothLeBroadcastSubgroupSettings implements Parcelable {
@SystemApi
@NonNull
public BluetoothLeBroadcastSubgroupSettings build() {
- Objects.requireNonNull(mContentMetadata, "ContentMetadata is null");
+ requireNonNull(mContentMetadata);
if (mPreferredQuality != QUALITY_STANDARD && mPreferredQuality != QUALITY_HIGH) {
throw new IllegalArgumentException(
"Must set audio quality to either Standard or High");
diff --git a/framework/java/android/bluetooth/BluetoothPan.java b/framework/java/android/bluetooth/BluetoothPan.java
index 95702abd48..15066a0297 100644
--- a/framework/java/android/bluetooth/BluetoothPan.java
+++ b/framework/java/android/bluetooth/BluetoothPan.java
@@ -22,6 +22,8 @@ import static android.Manifest.permission.TETHER_PRIVILEGED;
import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
import static android.bluetooth.BluetoothUtils.executeFromBinder;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -47,7 +49,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collections;
import java.util.List;
-import java.util.Objects;
import java.util.concurrent.Executor;
/**
@@ -541,8 +542,8 @@ public final class BluetoothPan implements BluetoothProfile {
@Nullable
public TetheredInterfaceRequest requestTetheredInterface(
@NonNull final Executor executor, @NonNull final TetheredInterfaceCallback callback) {
- Objects.requireNonNull(callback, "Callback must be non-null");
- Objects.requireNonNull(executor, "Executor must be non-null");
+ requireNonNull(callback);
+ requireNonNull(executor);
final IBluetoothPan service = getService();
if (service == null) {
Log.w(TAG, "Proxy not attached to service");
diff --git a/framework/java/android/bluetooth/BluetoothQualityReport.java b/framework/java/android/bluetooth/BluetoothQualityReport.java
index b3dae7d7e5..99a234f551 100644
--- a/framework/java/android/bluetooth/BluetoothQualityReport.java
+++ b/framework/java/android/bluetooth/BluetoothQualityReport.java
@@ -17,6 +17,8 @@
package android.bluetooth;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.DurationMillisLong;
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
@@ -33,7 +35,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import java.util.Objects;
/**
* This class provides the System APIs to access the data of BQR event reported from firmware side.
@@ -613,7 +614,7 @@ public final class BluetoothQualityReport implements Parcelable {
*/
@SystemApi
public Builder(@NonNull byte[] rawData) {
- this.rawData = Objects.requireNonNull(rawData);
+ this.rawData = requireNonNull(rawData);
}
/**
diff --git a/framework/java/android/bluetooth/BluetoothSap.java b/framework/java/android/bluetooth/BluetoothSap.java
index 4d3e2f2416..8d467720ff 100644
--- a/framework/java/android/bluetooth/BluetoothSap.java
+++ b/framework/java/android/bluetooth/BluetoothSap.java
@@ -19,6 +19,8 @@ package android.bluetooth;
import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.NonNull;
import android.annotation.RequiresNoPermission;
import android.annotation.RequiresPermission;
@@ -41,7 +43,6 @@ import android.util.Pair;
import java.util.Collections;
import java.util.List;
-import java.util.Objects;
/**
* This class provides the APIs to control the Bluetooth SIM Access Profile (SAP).
@@ -462,7 +463,7 @@ public final class BluetoothSap 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");
+ requireNonNull(device);
final IBluetoothSap service = getService();
if (service == null) {
Log.w(TAG, "Proxy not attached to service");
@@ -513,7 +514,7 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable {
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
if (VDBG) log("getConnectionPolicy(" + device + ")");
- Objects.requireNonNull(device, "BluetoothDevice cannot be null");
+ requireNonNull(device);
final IBluetoothSap service = getService();
if (service == null) {
Log.w(TAG, "Proxy not attached to service");
diff --git a/framework/java/android/bluetooth/le/AdvertisingSet.java b/framework/java/android/bluetooth/le/AdvertisingSet.java
index 5b3299b120..9df049bf08 100644
--- a/framework/java/android/bluetooth/le/AdvertisingSet.java
+++ b/framework/java/android/bluetooth/le/AdvertisingSet.java
@@ -54,7 +54,7 @@ public final class AdvertisingSet {
AttributionSource attributionSource) {
mAdvertiserId = advertiserId;
mAttributionSource = attributionSource;
- mAdvertise = requireNonNull(advertise, "Bluetooth advertise cannot be null");
+ mAdvertise = requireNonNull(advertise);
}
/* package */ void setAdvertiserId(int advertiserId) {
diff --git a/framework/java/android/bluetooth/le/AdvertisingSetParameters.java b/framework/java/android/bluetooth/le/AdvertisingSetParameters.java
index 2ea4c700f9..9c27e48567 100644
--- a/framework/java/android/bluetooth/le/AdvertisingSetParameters.java
+++ b/framework/java/android/bluetooth/le/AdvertisingSetParameters.java
@@ -16,6 +16,8 @@
package android.bluetooth.le;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -31,7 +33,6 @@ import com.android.bluetooth.flags.Flags;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.util.Objects;
/**
* The {@link AdvertisingSetParameters} provide a way to adjust advertising preferences for each
@@ -605,7 +606,7 @@ public final class AdvertisingSetParameters implements Parcelable {
@FlaggedApi(Flags.FLAG_DIRECTED_ADVERTISING_API)
@SystemApi
public @NonNull Builder setPeerAddress(@NonNull String peerAddress) {
- Objects.requireNonNull(peerAddress, "peerAddress is null");
+ requireNonNull(peerAddress);
if (!BluetoothAdapter.checkBluetoothAddress(peerAddress)) {
throw new IllegalArgumentException(
peerAddress + " is not a valid Bluetooth address");
diff --git a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java b/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java
index e43838f8be..b835580c6c 100644
--- a/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java
+++ b/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java
@@ -19,6 +19,8 @@ package android.bluetooth.le;
import static android.Manifest.permission.BLUETOOTH_ADVERTISE;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresNoPermission;
@@ -43,7 +45,6 @@ import android.util.Log;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import java.util.Objects;
/**
* This class provides a way to perform Bluetooth LE advertise operations, such as starting and
@@ -83,7 +84,7 @@ public final class BluetoothLeAdvertiser {
* @hide
*/
public BluetoothLeAdvertiser(BluetoothAdapter bluetoothAdapter) {
- mBluetoothAdapter = Objects.requireNonNull(bluetoothAdapter);
+ mBluetoothAdapter = requireNonNull(bluetoothAdapter);
mAttributionSource = mBluetoothAdapter.getAttributionSource();
mHandler = new Handler(Looper.getMainLooper());
}
diff --git a/framework/java/android/bluetooth/le/BluetoothLeScanner.java b/framework/java/android/bluetooth/le/BluetoothLeScanner.java
index c116540496..aeac2e2f0f 100644
--- a/framework/java/android/bluetooth/le/BluetoothLeScanner.java
+++ b/framework/java/android/bluetooth/le/BluetoothLeScanner.java
@@ -19,6 +19,8 @@ package android.bluetooth.le;
import static android.Manifest.permission.BLUETOOTH_SCAN;
import static android.Manifest.permission.UPDATE_DEVICE_STATS;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresNoPermission;
@@ -44,7 +46,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
/**
* This class provides methods to perform scan related operations for Bluetooth LE devices. An
@@ -96,7 +97,7 @@ public final class BluetoothLeScanner {
* @hide
*/
public BluetoothLeScanner(BluetoothAdapter bluetoothAdapter) {
- mBluetoothAdapter = Objects.requireNonNull(bluetoothAdapter);
+ mBluetoothAdapter = requireNonNull(bluetoothAdapter);
mAttributionSource = mBluetoothAdapter.getAttributionSource();
mHandler = new Handler(Looper.getMainLooper());
mLeScanClients = new HashMap<ScanCallback, BleScanCallbackWrapper>();
diff --git a/framework/java/android/bluetooth/le/DistanceMeasurementManager.java b/framework/java/android/bluetooth/le/DistanceMeasurementManager.java
index b68d3556e4..88933ae5d9 100644
--- a/framework/java/android/bluetooth/le/DistanceMeasurementManager.java
+++ b/framework/java/android/bluetooth/le/DistanceMeasurementManager.java
@@ -19,6 +19,8 @@ package android.bluetooth.le;
import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -42,7 +44,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -75,7 +76,7 @@ public final class DistanceMeasurementManager {
* @hide
*/
public DistanceMeasurementManager(BluetoothAdapter bluetoothAdapter) {
- mBluetoothAdapter = Objects.requireNonNull(bluetoothAdapter);
+ mBluetoothAdapter = requireNonNull(bluetoothAdapter);
mAttributionSource = mBluetoothAdapter.getAttributionSource();
mUuid = new ParcelUuid(UUID.randomUUID());
}
@@ -133,9 +134,9 @@ public final class DistanceMeasurementManager {
@NonNull DistanceMeasurementParams params,
@NonNull Executor executor,
@NonNull DistanceMeasurementSession.Callback callback) {
- Objects.requireNonNull(params, "params is null");
- Objects.requireNonNull(executor, "executor is null");
- Objects.requireNonNull(callback, "callback is null");
+ requireNonNull(params);
+ requireNonNull(executor);
+ requireNonNull(callback);
try {
IDistanceMeasurement distanceMeasurement = mBluetoothAdapter.getDistanceMeasurement();
if (distanceMeasurement == null) {
@@ -188,7 +189,7 @@ public final class DistanceMeasurementManager {
@RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED})
@CsSecurityLevel
public int getChannelSoundingMaxSupportedSecurityLevel(@NonNull BluetoothDevice remoteDevice) {
- Objects.requireNonNull(remoteDevice, "remote device is null");
+ requireNonNull(remoteDevice);
final int defaultValue = ChannelSoundingParams.CS_SECURITY_LEVEL_UNKNOWN;
try {
IDistanceMeasurement distanceMeasurement = mBluetoothAdapter.getDistanceMeasurement();
diff --git a/framework/java/android/bluetooth/le/DistanceMeasurementParams.java b/framework/java/android/bluetooth/le/DistanceMeasurementParams.java
index 896e4e5ff9..51a4a595a9 100644
--- a/framework/java/android/bluetooth/le/DistanceMeasurementParams.java
+++ b/framework/java/android/bluetooth/le/DistanceMeasurementParams.java
@@ -16,6 +16,8 @@
package android.bluetooth.le;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
@@ -28,7 +30,6 @@ import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.util.Objects;
/**
* The {@link DistanceMeasurementParams} provide a way to adjust distance measurement preferences.
@@ -84,7 +85,7 @@ public final class DistanceMeasurementParams implements Parcelable {
int frequency,
int methodId,
ChannelSoundingParams channelSoundingParams) {
- mDevice = Objects.requireNonNull(device);
+ mDevice = requireNonNull(device);
mDuration = duration;
mFrequency = frequency;
mMethodId = methodId;
@@ -234,7 +235,7 @@ public final class DistanceMeasurementParams implements Parcelable {
* @param device the remote device for the distance measurement
*/
public Builder(@NonNull BluetoothDevice device) {
- mDevice = Objects.requireNonNull(device);
+ mDevice = requireNonNull(device);
}
/**
diff --git a/framework/java/android/bluetooth/le/PeriodicAdvertisingManager.java b/framework/java/android/bluetooth/le/PeriodicAdvertisingManager.java
index 93283b5a5c..863bfffdea 100644
--- a/framework/java/android/bluetooth/le/PeriodicAdvertisingManager.java
+++ b/framework/java/android/bluetooth/le/PeriodicAdvertisingManager.java
@@ -18,6 +18,8 @@ package android.bluetooth.le;
import static android.Manifest.permission.BLUETOOTH_SCAN;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
@@ -35,7 +37,6 @@ import android.os.RemoteException;
import android.util.Log;
import java.util.IdentityHashMap;
-import java.util.Objects;
/**
* This class provides methods to perform periodic advertising related operations. An application
@@ -68,7 +69,7 @@ public final class PeriodicAdvertisingManager {
* @hide
*/
public PeriodicAdvertisingManager(BluetoothAdapter bluetoothAdapter) {
- mBluetoothAdapter = Objects.requireNonNull(bluetoothAdapter);
+ mBluetoothAdapter = requireNonNull(bluetoothAdapter);
mAttributionSource = mBluetoothAdapter.getAttributionSource();
mCallbackWrappers = new IdentityHashMap<>();
}
diff --git a/framework/java/android/bluetooth/le/TransportBlockFilter.java b/framework/java/android/bluetooth/le/TransportBlockFilter.java
index d775562163..5da9bf658f 100644
--- a/framework/java/android/bluetooth/le/TransportBlockFilter.java
+++ b/framework/java/android/bluetooth/le/TransportBlockFilter.java
@@ -16,6 +16,8 @@
package android.bluetooth.le;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
@@ -433,8 +435,8 @@ public final class TransportBlockFilter implements Parcelable {
"setWifiNanHash() should be used instead of setTransportData() when orgId "
+ "is WIFI_ALLIANCE_NEIGHBOR_AWARENESS_NETWORKING");
}
- Objects.requireNonNull(transportData);
- Objects.requireNonNull(transportDataMask);
+ requireNonNull(transportData);
+ requireNonNull(transportDataMask);
if (transportData.length == 0) {
throw new IllegalArgumentException("transportData is empty");
}
@@ -476,7 +478,7 @@ public final class TransportBlockFilter implements Parcelable {
"setWifiNanHash() can only be used when orgId is"
+ " WIFI_ALLIANCE_NEIGHBOR_AWARENESS_NETWORKING");
}
- Objects.requireNonNull(wifiNanHash);
+ requireNonNull(wifiNanHash);
if (wifiNanHash.length != WIFI_NAN_HASH_LENGTH_BYTES) {
throw new IllegalArgumentException("Wi-Fi NAN hash must be 8 octets long");
}