summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/OobData.java
diff options
context:
space:
mode:
authorRahul Sabnis <rahulsabnis@google.com>2021-06-10 17:28:38 -0700
committerRahul Sabnis <rahulsabnis@google.com>2021-06-14 23:40:27 +0000
commit508506d886e5bc53c0b39ffabaaa8d4aa9881551 (patch)
tree98d6f93227d30efdce0e8c87d0d19ae5a2561f2e /framework/java/android/bluetooth/OobData.java
parent0a67fabedbf8f985ba2c7b85591213a3f053590a (diff)
Update nullability checks to use Objects#requireNonNull
instead of deprecated method in Preconditions class Tag: #feature Bug: 190767948 Test: Manual Merged-In: Ie7f7282b89c13f587fdfe1bf3288eb4a3c7dcc6e Change-Id: Ie7f7282b89c13f587fdfe1bf3288eb4a3c7dcc6e
Diffstat (limited to 'framework/java/android/bluetooth/OobData.java')
-rw-r--r--framework/java/android/bluetooth/OobData.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/framework/java/android/bluetooth/OobData.java b/framework/java/android/bluetooth/OobData.java
index 2dfa91dcba..4e5ede74ce 100644
--- a/framework/java/android/bluetooth/OobData.java
+++ b/framework/java/android/bluetooth/OobData.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;
@@ -23,8 +25,6 @@ import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
-import com.android.internal.util.Preconditions;
-
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -214,7 +214,7 @@ public final class OobData implements Parcelable {
@NonNull
@SystemApi
public LeBuilder setDeviceName(@NonNull byte[] deviceName) {
- Preconditions.checkNotNull(deviceName);
+ requireNonNull(deviceName);
this.mDeviceName = deviceName;
return this;
}
@@ -308,8 +308,8 @@ public final class OobData implements Parcelable {
@SystemApi
public LeBuilder(@NonNull byte[] confirmationHash, @NonNull byte[] deviceAddressWithType,
@LeRole int leDeviceRole) {
- Preconditions.checkNotNull(confirmationHash);
- Preconditions.checkNotNull(deviceAddressWithType);
+ requireNonNull(confirmationHash);
+ requireNonNull(deviceAddressWithType);
if (confirmationHash.length != OobData.CONFIRMATION_OCTETS) {
throw new IllegalArgumentException("confirmationHash must be "
+ OobData.CONFIRMATION_OCTETS + " octets in length.");
@@ -344,7 +344,7 @@ public final class OobData implements Parcelable {
@NonNull
@SystemApi
public LeBuilder setLeTemporaryKey(@NonNull byte[] leTemporaryKey) {
- Preconditions.checkNotNull(leTemporaryKey);
+ requireNonNull(leTemporaryKey);
if (leTemporaryKey.length != LE_TK_OCTETS) {
throw new IllegalArgumentException("leTemporaryKey must be "
+ LE_TK_OCTETS + " octets in length.");
@@ -366,7 +366,7 @@ public final class OobData implements Parcelable {
@NonNull
@SystemApi
public LeBuilder setRandomizerHash(@NonNull byte[] randomizerHash) {
- Preconditions.checkNotNull(randomizerHash);
+ requireNonNull(randomizerHash);
if (randomizerHash.length != OobData.RANDOMIZER_OCTETS) {
throw new IllegalArgumentException("randomizerHash must be "
+ OobData.RANDOMIZER_OCTETS + " octets in length.");
@@ -534,9 +534,9 @@ public final class OobData implements Parcelable {
@SystemApi
public ClassicBuilder(@NonNull byte[] confirmationHash, @NonNull byte[] classicLength,
@NonNull byte[] deviceAddressWithType) {
- Preconditions.checkNotNull(confirmationHash);
- Preconditions.checkNotNull(classicLength);
- Preconditions.checkNotNull(deviceAddressWithType);
+ requireNonNull(confirmationHash);
+ requireNonNull(classicLength);
+ requireNonNull(deviceAddressWithType);
if (confirmationHash.length != OobData.CONFIRMATION_OCTETS) {
throw new IllegalArgumentException("confirmationHash must be "
+ OobData.CONFIRMATION_OCTETS + " octets in length.");
@@ -567,7 +567,7 @@ public final class OobData implements Parcelable {
@NonNull
@SystemApi
public ClassicBuilder setRandomizerHash(@NonNull byte[] randomizerHash) {
- Preconditions.checkNotNull(randomizerHash);
+ requireNonNull(randomizerHash);
if (randomizerHash.length != OobData.RANDOMIZER_OCTETS) {
throw new IllegalArgumentException("randomizerHash must be "
+ OobData.RANDOMIZER_OCTETS + " octets in length.");
@@ -592,7 +592,7 @@ public final class OobData implements Parcelable {
@NonNull
@SystemApi
public ClassicBuilder setDeviceName(@NonNull byte[] deviceName) {
- Preconditions.checkNotNull(deviceName);
+ requireNonNull(deviceName);
this.mDeviceName = deviceName;
return this;
}
@@ -617,7 +617,7 @@ public final class OobData implements Parcelable {
@NonNull
@SystemApi
public ClassicBuilder setClassOfDevice(@NonNull byte[] classOfDevice) {
- Preconditions.checkNotNull(classOfDevice);
+ requireNonNull(classOfDevice);
if (classOfDevice.length != OobData.CLASS_OF_DEVICE_OCTETS) {
throw new IllegalArgumentException("classOfDevice must be "
+ OobData.CLASS_OF_DEVICE_OCTETS + " octets in length.");