Use androidx.annotation.Nullable instead and optimize imports.
Test: atest -v CtsSeekerDiscoverProviderTest
BUG: 216079944
Change-Id: I56981da90c7fc9dba593ba33ee4e1783d2c89f67
diff --git a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerConfig.java b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerConfig.java
index 132e026..9fa54fe 100644
--- a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerConfig.java
+++ b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerConfig.java
@@ -4,14 +4,17 @@
import android.annotation.TargetApi;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattService;
+
+import androidx.annotation.Nullable;
+
import com.android.server.nearby.common.bluetooth.BluetoothConsts;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
-import javax.annotation.Nullable;
/** Configuration of a GATT server. */
@TargetApi(18)
diff --git a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerConnection.java b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerConnection.java
index df1a832..b67e00e 100644
--- a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerConnection.java
+++ b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerConnection.java
@@ -5,6 +5,9 @@
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.util.Log;
+
+import androidx.annotation.Nullable;
+
import com.android.server.nearby.common.bluetooth.BluetoothException;
import com.android.server.nearby.common.bluetooth.BluetoothGattException;
import com.android.server.nearby.common.bluetooth.ReservedUuids;
@@ -12,12 +15,12 @@
import com.android.server.nearby.common.bluetooth.util.BluetoothGattUtils;
import com.android.server.nearby.common.bluetooth.util.BluetoothOperationExecutor;
import com.android.server.nearby.common.bluetooth.util.BluetoothOperationExecutor.Operation;
+
import com.google.common.annotations.VisibleForTesting;
-// import com.google.common.annotations.VisibleForTesting.Visibility;
-import com.android.internal.annotations.VisibleForTesting.Visibility;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.io.BaseEncoding;
+
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
@@ -29,7 +32,6 @@
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
/**
* Connection to a bluetooth LE device over Gatt.
diff --git a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerHelper.java b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerHelper.java
index 3cec24a..0ba96c0 100644
--- a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerHelper.java
+++ b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServerHelper.java
@@ -9,8 +9,10 @@
import android.content.Context;
import android.os.Build.VERSION_CODES;
import android.util.Log;
+
+import androidx.annotation.Nullable;
+
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.annotations.VisibleForTesting.Visibility;
import com.android.server.nearby.common.bluetooth.BluetoothException;
import com.android.server.nearby.common.bluetooth.BluetoothGattException;
import com.android.server.nearby.common.bluetooth.testability.VersionProvider;
@@ -21,12 +23,12 @@
import com.android.server.nearby.common.bluetooth.util.BluetoothGattUtils;
import com.android.server.nearby.common.bluetooth.util.BluetoothOperationExecutor;
import com.android.server.nearby.common.bluetooth.util.BluetoothOperationExecutor.Operation;
-// import com.google.common.annotations.VisibleForTesting;
+
import com.google.common.base.Preconditions;
+
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
/**
* Helper for simplifying operations on {@link BluetoothGattServer}.
diff --git a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServlet.java b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServlet.java
index 4c8499c..c4a2473 100644
--- a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServlet.java
+++ b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/gatt/server/BluetoothGattServlet.java
@@ -4,6 +4,7 @@
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
+
import com.android.server.nearby.common.bluetooth.BluetoothGattException;
import com.android.server.nearby.common.bluetooth.gatt.server.BluetoothGattServerConnection.Notifier;
diff --git a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothManager.java b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothManager.java
index 9f47426..4ccfb59 100644
--- a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothManager.java
+++ b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothManager.java
@@ -17,9 +17,11 @@
package com.android.server.nearby.common.bluetooth.testability.android.bluetooth;
import android.content.Context;
+
+import androidx.annotation.Nullable;
+
import java.util.ArrayList;
import java.util.List;
-import javax.annotation.Nullable;
/**
* Mockable wrapper of {@link android.bluetooth.BluetoothManager}.
@@ -37,13 +39,15 @@
* android.bluetooth.BluetoothGattServerCallback)}.
*/
@Nullable
- public BluetoothGattServer openGattServer(Context context, BluetoothGattServerCallback callback) {
- return BluetoothGattServer.wrap(mWrappedInstance.openGattServer(context, callback.unwrap()));
+ public BluetoothGattServer openGattServer(Context context,
+ BluetoothGattServerCallback callback) {
+ return BluetoothGattServer.wrap(
+ mWrappedInstance.openGattServer(context, callback.unwrap()));
}
/**
* See {@link android.bluetooth.BluetoothManager#getConnectionState(
- * android.bluetooth.BluetoothDevice, int)}.
+ *android.bluetooth.BluetoothDevice, int)}.
*/
public int getConnectionState(BluetoothDevice device, int profile) {
return mWrappedInstance.getConnectionState(device.unwrap(), profile);
@@ -51,7 +55,8 @@
/** See {@link android.bluetooth.BluetoothManager#getConnectedDevices(int)}. */
public List<BluetoothDevice> getConnectedDevices(int profile) {
- List<android.bluetooth.BluetoothDevice> devices = mWrappedInstance.getConnectedDevices(profile);
+ List<android.bluetooth.BluetoothDevice> devices = mWrappedInstance.getConnectedDevices(
+ profile);
List<BluetoothDevice> wrappedDevices = new ArrayList<>(devices.size());
for (android.bluetooth.BluetoothDevice device : devices) {
wrappedDevices.add(BluetoothDevice.wrap(device));
diff --git a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtils.java b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtils.java
index b8e1b08..e90b732 100644
--- a/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtils.java
+++ b/nearby/tests/multidevices/clients/src/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtils.java
@@ -20,12 +20,14 @@
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
+
+import androidx.annotation.Nullable;
+
import com.android.server.nearby.common.bluetooth.BluetoothException;
+
import java.lang.reflect.Field;
import java.util.Arrays;
-import javax.annotation.Nullable;
-
/**
* Utils for Gatt profile.
*/
@@ -66,12 +68,14 @@
/** Clones a {@link BluetoothGattCharacteristic} so the value can be changed thread-safely. */
public static BluetoothGattCharacteristic clone(BluetoothGattCharacteristic characteristic)
throws BluetoothException {
- BluetoothGattCharacteristic result = new BluetoothGattCharacteristic(characteristic.getUuid(),
+ BluetoothGattCharacteristic result = new BluetoothGattCharacteristic(
+ characteristic.getUuid(),
characteristic.getProperties(), characteristic.getPermissions());
try {
Field instanceIdField = BluetoothGattCharacteristic.class.getDeclaredField("mInstance");
Field serviceField = BluetoothGattCharacteristic.class.getDeclaredField("mService");
- Field descriptorField = BluetoothGattCharacteristic.class.getDeclaredField("mDescriptors");
+ Field descriptorField = BluetoothGattCharacteristic.class.getDeclaredField(
+ "mDescriptors");
instanceIdField.setAccessible(true);
serviceField.setAccessible(true);
descriptorField.setAccessible(true);