diff --git a/nearby/service/java/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattConnection.java b/nearby/service/java/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattConnection.java
index 8e66ff2..de131e4 100644
--- a/nearby/service/java/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattConnection.java
+++ b/nearby/service/java/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattConnection.java
@@ -19,6 +19,7 @@
 import android.bluetooth.BluetoothGattCharacteristic;
 import android.bluetooth.BluetoothGattDescriptor;
 import android.bluetooth.BluetoothGattService;
+import android.bluetooth.BluetoothStatusCodes;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
@@ -31,7 +32,7 @@
 import com.android.server.nearby.common.bluetooth.gatt.BluetoothGattHelper.ConnectionOptions;
 import com.android.server.nearby.common.bluetooth.gatt.BluetoothGattHelper.OperationType;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothDevice;
-import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothGatt;
+import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothGattWrapper;
 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;
@@ -68,7 +69,7 @@
     @VisibleForTesting
     static final int GATT_ERROR = 133;
 
-    private final BluetoothGatt mGatt;
+    private final BluetoothGattWrapper mGatt;
     private final BluetoothOperationExecutor mBluetoothOperationExecutor;
     private final ConnectionOptions mConnectionOptions;
 
@@ -86,7 +87,7 @@
     private long mOperationTimeoutMillis = OPERATION_TIMEOUT_MILLIS;
 
     BluetoothGattConnection(
-            BluetoothGatt gatt,
+            BluetoothGattWrapper gatt,
             BluetoothOperationExecutor bluetoothOperationExecutor,
             ConnectionOptions connectionOptions) {
         mGatt = gatt;
@@ -400,13 +401,12 @@
                     new Operation<Void>(OperationType.WRITE_CHARACTERISTIC, mGatt, characteristic) {
                         @Override
                         public void run() throws BluetoothException {
-                            BluetoothGattCharacteristic characteristiClone =
-                                    BluetoothGattUtils.clone(characteristic);
-                            characteristiClone.setValue(value);
-                            boolean success = mGatt.writeCharacteristic(characteristiClone);
-                            if (!success) {
+                            int writeCharacteristicResponseCode = mGatt.writeCharacteristic(
+                                    characteristic, value, characteristic.getWriteType());
+                            if (writeCharacteristicResponseCode != BluetoothStatusCodes.SUCCESS) {
                                 throw new BluetoothException(
-                                        "gatt.writeCharacteristic returned false.");
+                                        "gatt.writeCharacteristic returned "
+                                        + writeCharacteristicResponseCode);
                             }
                         }
                     },
@@ -478,13 +478,12 @@
                     new Operation<Void>(OperationType.WRITE_DESCRIPTOR, mGatt, descriptor) {
                         @Override
                         public void run() throws BluetoothException {
-                            BluetoothGattDescriptor descriptorClone =
-                                    BluetoothGattUtils.clone(descriptor);
-                            descriptorClone.setValue(value);
-                            boolean success = mGatt.writeDescriptor(descriptorClone);
-                            if (!success) {
+                            int writeDescriptorResponseCode = mGatt.writeDescriptor(descriptor,
+                                    value);
+                            if (writeDescriptorResponseCode != BluetoothStatusCodes.SUCCESS) {
                                 throw new BluetoothException(
-                                        "gatt.writeDescriptor returned false.");
+                                        "gatt.writeDescriptor returned "
+                                        + writeDescriptorResponseCode);
                             }
                         }
                     },
diff --git a/nearby/service/java/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattHelper.java b/nearby/service/java/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattHelper.java
index 04a9a58..18a9f5f 100644
--- a/nearby/service/java/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattHelper.java
+++ b/nearby/service/java/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattHelper.java
@@ -16,6 +16,7 @@
 
 package com.android.server.nearby.common.bluetooth.gatt;
 
+import android.bluetooth.BluetoothGatt;
 import android.bluetooth.BluetoothGattCharacteristic;
 import android.bluetooth.BluetoothGattDescriptor;
 import android.bluetooth.le.ScanFilter;
@@ -30,8 +31,8 @@
 import com.android.server.nearby.common.bluetooth.BluetoothException;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothAdapter;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothDevice;
-import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothGatt;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothGattCallback;
+import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothGattWrapper;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.le.BluetoothLeScanner;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.le.ScanCallback;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.le.ScanResult;
@@ -56,7 +57,8 @@
 import javax.annotation.concurrent.GuardedBy;
 
 /**
- * Wrapper of {@link BluetoothGatt} that provides blocking methods, errors and timeout handling.
+ * Wrapper of {@link BluetoothGattWrapper} that provides blocking methods, errors and timeout
+ * handling.
  */
 @SuppressWarnings("Guava") // java.util.Optional is not available until API 24
 public class BluetoothGattHelper {
@@ -109,7 +111,7 @@
     final BluetoothGattCallback mBluetoothGattCallback =
             new InternalBluetoothGattCallback();
     @VisibleForTesting
-    final ConcurrentMap<BluetoothGatt, BluetoothGattConnection> mConnections =
+    final ConcurrentMap<BluetoothGattWrapper, BluetoothGattConnection> mConnections =
             new ConcurrentHashMap<>();
 
     private final Context mApplicationContext;
@@ -233,7 +235,7 @@
 
                     @GuardedBy("mLock")
                     @Nullable(/* null before operation is executed */)
-                    private BluetoothGatt mBluetoothGatt;
+                    private BluetoothGattWrapper mBluetoothGatt;
 
                     @Override
                     public void run() throws BluetoothException {
@@ -241,15 +243,15 @@
                             if (mIsCanceled) {
                                 return;
                             }
-                            BluetoothGatt bluetoothGatt;
+                            BluetoothGattWrapper bluetoothGattWrapper;
                             Log.d(TAG, "Use LE transport");
-                            bluetoothGatt =
+                            bluetoothGattWrapper =
                                     bluetoothDevice.connectGatt(
                                             mApplicationContext,
                                             options.autoConnect(),
                                             mBluetoothGattCallback,
                                             android.bluetooth.BluetoothDevice.TRANSPORT_LE);
-                            if (bluetoothGatt == null) {
+                            if (bluetoothGattWrapper == null) {
                                 throw new BluetoothException("connectGatt() returned null.");
                             }
 
@@ -270,7 +272,7 @@
                                     // here until true is returned.
                                     int connectionPriority = connectionPriorityOption.get();
                                     long startTimeMillis = System.currentTimeMillis();
-                                    while (!bluetoothGatt.requestConnectionPriority(
+                                    while (!bluetoothGattWrapper.requestConnectionPriority(
                                             connectionPriority)) {
                                         if (System.currentTimeMillis() - startTimeMillis
                                                 > options.connectionTimeoutMillis()) {
@@ -292,15 +294,15 @@
                                 }
                             } catch (Exception e) {
                                 // Make sure to clean connection.
-                                bluetoothGatt.disconnect();
-                                bluetoothGatt.close();
+                                bluetoothGattWrapper.disconnect();
+                                bluetoothGattWrapper.close();
                                 throw e;
                             }
 
                             BluetoothGattConnection connection = new BluetoothGattConnection(
-                                    bluetoothGatt, mBluetoothOperationExecutor, options);
-                            mConnections.put(bluetoothGatt, connection);
-                            mBluetoothGatt = bluetoothGatt;
+                                    bluetoothGattWrapper, mBluetoothOperationExecutor, options);
+                            mConnections.put(bluetoothGattWrapper, connection);
+                            mBluetoothGatt = bluetoothGattWrapper;
                         }
                     }
 
@@ -312,13 +314,13 @@
                                 return;
                             }
                             mIsCanceled = true;
-                            BluetoothGatt bluetoothGatt = mBluetoothGatt;
-                            if (bluetoothGatt == null) {
+                            BluetoothGattWrapper bluetoothGattWrapper = mBluetoothGatt;
+                            if (bluetoothGattWrapper == null) {
                                 return;
                             }
-                            mConnections.remove(bluetoothGatt);
-                            bluetoothGatt.disconnect();
-                            bluetoothGatt.close();
+                            mConnections.remove(bluetoothGattWrapper);
+                            bluetoothGattWrapper.disconnect();
+                            bluetoothGattWrapper.close();
                         }
                     }
                 };
@@ -335,7 +337,7 @@
         return result;
     }
 
-    private BluetoothGattConnection getConnectionByGatt(BluetoothGatt gatt)
+    private BluetoothGattConnection getConnectionByGatt(BluetoothGattWrapper gatt)
             throws BluetoothException {
         BluetoothGattConnection connection = mConnections.get(gatt);
         if (connection == null) {
@@ -347,7 +349,7 @@
     private class InternalBluetoothGattCallback extends BluetoothGattCallback {
 
         @Override
-        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
+        public void onConnectionStateChange(BluetoothGattWrapper gatt, int status, int newState) {
             BluetoothGattConnection connection;
             BluetoothDevice device = gatt.getDevice();
             switch (newState) {
@@ -430,7 +432,7 @@
         }
 
         @Override
-        public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {
+        public void onMtuChanged(BluetoothGattWrapper gatt, int mtu, int status) {
             BluetoothGattConnection connection = mConnections.get(gatt);
             BluetoothDevice device = gatt.getDevice();
             if (connection == null) {
@@ -460,13 +462,13 @@
         }
 
         @Override
-        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
+        public void onServicesDiscovered(BluetoothGattWrapper gatt, int status) {
             mBluetoothOperationExecutor.notifyCompletion(
                     new Operation<Void>(OperationType.DISCOVER_SERVICES_INTERNAL, gatt), status);
         }
 
         @Override
-        public void onCharacteristicRead(BluetoothGatt gatt,
+        public void onCharacteristicRead(BluetoothGattWrapper gatt,
                 BluetoothGattCharacteristic characteristic, int status) {
             mBluetoothOperationExecutor.notifyCompletion(
                     new Operation<byte[]>(OperationType.READ_CHARACTERISTIC, gatt, characteristic),
@@ -474,14 +476,14 @@
         }
 
         @Override
-        public void onCharacteristicWrite(BluetoothGatt gatt,
+        public void onCharacteristicWrite(BluetoothGattWrapper gatt,
                 BluetoothGattCharacteristic characteristic, int status) {
             mBluetoothOperationExecutor.notifyCompletion(new Operation<Void>(
                     OperationType.WRITE_CHARACTERISTIC, gatt, characteristic), status);
         }
 
         @Override
-        public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
+        public void onDescriptorRead(BluetoothGattWrapper gatt, BluetoothGattDescriptor descriptor,
                 int status) {
             mBluetoothOperationExecutor.notifyCompletion(
                     new Operation<byte[]>(OperationType.READ_DESCRIPTOR, gatt, descriptor), status,
@@ -489,7 +491,7 @@
         }
 
         @Override
-        public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
+        public void onDescriptorWrite(BluetoothGattWrapper gatt, BluetoothGattDescriptor descriptor,
                 int status) {
             Log.d(TAG, String.format("onDescriptorWrite %s, %s, %d",
                     gatt.getDevice(), descriptor.getUuid(), status));
@@ -498,19 +500,19 @@
         }
 
         @Override
-        public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
+        public void onReadRemoteRssi(BluetoothGattWrapper gatt, int rssi, int status) {
             mBluetoothOperationExecutor.notifyCompletion(
                     new Operation<Integer>(OperationType.READ_RSSI, gatt), status, rssi);
         }
 
         @Override
-        public void onReliableWriteCompleted(BluetoothGatt gatt, int status) {
+        public void onReliableWriteCompleted(BluetoothGattWrapper gatt, int status) {
             mBluetoothOperationExecutor.notifyCompletion(
                     new Operation<Void>(OperationType.WRITE_RELIABLE, gatt), status);
         }
 
         @Override
-        public void onCharacteristicChanged(BluetoothGatt gatt,
+        public void onCharacteristicChanged(BluetoothGattWrapper gatt,
                 BluetoothGattCharacteristic characteristic) {
             byte[] value = characteristic.getValue();
             if (value == null) {
diff --git a/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothDevice.java b/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothDevice.java
index c767af6..5b45f61 100644
--- a/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothDevice.java
+++ b/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothDevice.java
@@ -144,14 +144,14 @@
      * android.bluetooth.BluetoothGattCallback)}.
      */
     @Nullable(/* when bt service is not available */)
-    public BluetoothGatt connectGatt(Context context, boolean autoConnect,
+    public BluetoothGattWrapper connectGatt(Context context, boolean autoConnect,
             BluetoothGattCallback callback) {
         android.bluetooth.BluetoothGatt gatt =
                 mWrappedBluetoothDevice.connectGatt(context, autoConnect, callback.unwrap());
         if (gatt == null) {
             return null;
         }
-        return BluetoothGatt.wrap(gatt);
+        return BluetoothGattWrapper.wrap(gatt);
     }
 
     /**
@@ -160,7 +160,7 @@
      */
     @TargetApi(23)
     @Nullable(/* when bt service is not available */)
-    public BluetoothGatt connectGatt(Context context, boolean autoConnect,
+    public BluetoothGattWrapper connectGatt(Context context, boolean autoConnect,
             BluetoothGattCallback callback, int transport) {
         android.bluetooth.BluetoothGatt gatt =
                 mWrappedBluetoothDevice.connectGatt(
@@ -168,7 +168,7 @@
         if (gatt == null) {
             return null;
         }
-        return BluetoothGatt.wrap(gatt);
+        return BluetoothGattWrapper.wrap(gatt);
     }
 
 
diff --git a/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGattCallback.java b/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGattCallback.java
index 33d68cd..d36cfa2 100644
--- a/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGattCallback.java
+++ b/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGattCallback.java
@@ -31,26 +31,26 @@
      * See {@link android.bluetooth.BluetoothGattCallback#onConnectionStateChange(
      * android.bluetooth.BluetoothGatt, int, int)}
      */
-    public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {}
+    public void onConnectionStateChange(BluetoothGattWrapper gatt, int status, int newState) {}
 
     /**
      * See {@link android.bluetooth.BluetoothGattCallback#onServicesDiscovered(
      * android.bluetooth.BluetoothGatt,int)}
      */
-    public void onServicesDiscovered(BluetoothGatt gatt, int status) {}
+    public void onServicesDiscovered(BluetoothGattWrapper gatt, int status) {}
 
     /**
      * See {@link android.bluetooth.BluetoothGattCallback#onCharacteristicRead(
      * android.bluetooth.BluetoothGatt, BluetoothGattCharacteristic, int)}
      */
-    public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic,
-            int status) {}
+    public void onCharacteristicRead(BluetoothGattWrapper gatt, BluetoothGattCharacteristic
+            characteristic, int status) {}
 
     /**
      * See {@link android.bluetooth.BluetoothGattCallback#onCharacteristicWrite(
      * android.bluetooth.BluetoothGatt, BluetoothGattCharacteristic, int)}
      */
-    public void onCharacteristicWrite(BluetoothGatt gatt,
+    public void onCharacteristicWrite(BluetoothGattWrapper gatt,
             BluetoothGattCharacteristic characteristic, int status) {}
 
     /**
@@ -58,40 +58,40 @@
      * android.bluetooth.BluetoothGatt, BluetoothGattDescriptor, int)}
      */
     public void onDescriptorRead(
-            BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {}
+            BluetoothGattWrapper gatt, BluetoothGattDescriptor descriptor, int status) {}
 
     /**
      * See {@link android.bluetooth.BluetoothGattCallback#onDescriptorWrite(
      * android.bluetooth.BluetoothGatt, BluetoothGattDescriptor, int)}
      */
-    public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
+    public void onDescriptorWrite(BluetoothGattWrapper gatt, BluetoothGattDescriptor descriptor,
             int status) {}
 
     /**
      * See {@link android.bluetooth.BluetoothGattCallback#onReadRemoteRssi(
      * android.bluetooth.BluetoothGatt, int, int)}
      */
-    public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {}
+    public void onReadRemoteRssi(BluetoothGattWrapper gatt, int rssi, int status) {}
 
     /**
      * See {@link android.bluetooth.BluetoothGattCallback#onReliableWriteCompleted(
      * android.bluetooth.BluetoothGatt, int)}
      */
-    public void onReliableWriteCompleted(BluetoothGatt gatt, int status) {}
+    public void onReliableWriteCompleted(BluetoothGattWrapper gatt, int status) {}
 
     /**
      * See
      * {@link android.bluetooth.BluetoothGattCallback#onMtuChanged(android.bluetooth.BluetoothGatt,
      * int, int)}
      */
-    public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {}
+    public void onMtuChanged(BluetoothGattWrapper gatt, int mtu, int status) {}
 
     /**
      * See
      * {@link android.bluetooth.BluetoothGattCallback#onCharacteristicChanged(
      * android.bluetooth.BluetoothGatt, BluetoothGattCharacteristic)}
      */
-    public void onCharacteristicChanged(BluetoothGatt gatt,
+    public void onCharacteristicChanged(BluetoothGattWrapper gatt,
             BluetoothGattCharacteristic characteristic) {}
 
     /** Unwraps a Bluetooth Gatt callback. */
@@ -104,63 +104,66 @@
         @Override
         public void onConnectionStateChange(android.bluetooth.BluetoothGatt gatt, int status,
                 int newState) {
-            BluetoothGattCallback.this.onConnectionStateChange(BluetoothGatt.wrap(gatt), status,
-                    newState);
+            BluetoothGattCallback.this.onConnectionStateChange(BluetoothGattWrapper.wrap(gatt),
+                    status, newState);
         }
 
         @Override
         public void onServicesDiscovered(android.bluetooth.BluetoothGatt gatt, int status) {
-            BluetoothGattCallback.this.onServicesDiscovered(BluetoothGatt.wrap(gatt), status);
+            BluetoothGattCallback.this.onServicesDiscovered(BluetoothGattWrapper.wrap(gatt),
+                    status);
         }
 
         @Override
         public void onCharacteristicRead(android.bluetooth.BluetoothGatt gatt,
                 BluetoothGattCharacteristic characteristic, int status) {
             BluetoothGattCallback.this.onCharacteristicRead(
-                    BluetoothGatt.wrap(gatt), characteristic, status);
+                    BluetoothGattWrapper.wrap(gatt), characteristic, status);
         }
 
         @Override
         public void onCharacteristicWrite(android.bluetooth.BluetoothGatt gatt,
                 BluetoothGattCharacteristic characteristic, int status) {
             BluetoothGattCallback.this.onCharacteristicWrite(
-                    BluetoothGatt.wrap(gatt), characteristic, status);
+                    BluetoothGattWrapper.wrap(gatt), characteristic, status);
         }
 
         @Override
         public void onDescriptorRead(android.bluetooth.BluetoothGatt gatt,
                 BluetoothGattDescriptor descriptor, int status) {
             BluetoothGattCallback.this.onDescriptorRead(
-                    BluetoothGatt.wrap(gatt), descriptor, status);
+                    BluetoothGattWrapper.wrap(gatt), descriptor, status);
         }
 
         @Override
         public void onDescriptorWrite(android.bluetooth.BluetoothGatt gatt,
                 BluetoothGattDescriptor descriptor, int status) {
             BluetoothGattCallback.this.onDescriptorWrite(
-                    BluetoothGatt.wrap(gatt), descriptor, status);
+                    BluetoothGattWrapper.wrap(gatt), descriptor, status);
         }
 
         @Override
         public void onReadRemoteRssi(android.bluetooth.BluetoothGatt gatt, int rssi, int status) {
-            BluetoothGattCallback.this.onReadRemoteRssi(BluetoothGatt.wrap(gatt), rssi, status);
+            BluetoothGattCallback.this.onReadRemoteRssi(BluetoothGattWrapper.wrap(gatt), rssi,
+                    status);
         }
 
         @Override
         public void onReliableWriteCompleted(android.bluetooth.BluetoothGatt gatt, int status) {
-            BluetoothGattCallback.this.onReliableWriteCompleted(BluetoothGatt.wrap(gatt), status);
+            BluetoothGattCallback.this.onReliableWriteCompleted(BluetoothGattWrapper.wrap(gatt),
+                    status);
         }
 
         @Override
         public void onMtuChanged(android.bluetooth.BluetoothGatt gatt, int mtu, int status) {
-            BluetoothGattCallback.this.onMtuChanged(BluetoothGatt.wrap(gatt), mtu, status);
+            BluetoothGattCallback.this.onMtuChanged(BluetoothGattWrapper.wrap(gatt), mtu, status);
         }
 
         @Override
         public void onCharacteristicChanged(android.bluetooth.BluetoothGatt gatt,
                 BluetoothGattCharacteristic characteristic) {
             BluetoothGattCallback.this.onCharacteristicChanged(
-                    BluetoothGatt.wrap(gatt), characteristic);
+                    BluetoothGattWrapper.wrap(gatt), characteristic);
         }
     }
 }
diff --git a/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGatt.java b/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGattWrapper.java
similarity index 69%
rename from nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGatt.java
rename to nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGattWrapper.java
index bec762a..453ee5d 100644
--- a/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGatt.java
+++ b/nearby/service/java/com/android/server/nearby/common/bluetooth/testability/android/bluetooth/BluetoothGattWrapper.java
@@ -30,40 +30,11 @@
 import javax.annotation.Nullable;
 
 /** Mockable wrapper of {@link android.bluetooth.BluetoothGatt}. */
-@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
-public class BluetoothGatt {
-
-    /** See {@link android.bluetooth.BluetoothGatt#STATE_CONNECTED}. */
-    public static final int STATE_CONNECTED = android.bluetooth.BluetoothGatt.STATE_CONNECTED;
-
-    /** See {@link android.bluetooth.BluetoothGatt#STATE_DISCONNECTED}. */
-    public static final int STATE_DISCONNECTED = android.bluetooth.BluetoothGatt.STATE_DISCONNECTED;
-
-    /** See {@link android.bluetooth.BluetoothGatt#GATT_REQUEST_NOT_SUPPORTED}. */
-    public static final int GATT_REQUEST_NOT_SUPPORTED =
-            android.bluetooth.BluetoothGatt.GATT_REQUEST_NOT_SUPPORTED;
-
-    /** See {@link android.bluetooth.BluetoothGatt#GATT_SUCCESS}. */
-    public static final int GATT_SUCCESS = android.bluetooth.BluetoothGatt.GATT_SUCCESS;
-
-    /** See {@link android.bluetooth.BluetoothGatt#GATT_FAILURE}. */
-    public static final int GATT_FAILURE = android.bluetooth.BluetoothGatt.GATT_FAILURE;
-
-    /** See {@link android.bluetooth.BluetoothGatt#CONNECTION_PRIORITY_BALANCED}. */
-    public static final int CONNECTION_PRIORITY_BALANCED =
-            android.bluetooth.BluetoothGatt.CONNECTION_PRIORITY_BALANCED;
-
-    /** See {@link android.bluetooth.BluetoothGatt#CONNECTION_PRIORITY_HIGH}. */
-    public static final int CONNECTION_PRIORITY_HIGH =
-            android.bluetooth.BluetoothGatt.CONNECTION_PRIORITY_HIGH;
-
-    /** See {@link android.bluetooth.BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER}. */
-    public static final int CONNECTION_PRIORITY_LOW_POWER =
-            android.bluetooth.BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER;
-
+@TargetApi(Build.VERSION_CODES.TIRAMISU)
+public class BluetoothGattWrapper {
     private final android.bluetooth.BluetoothGatt mWrappedBluetoothGatt;
 
-    private BluetoothGatt(android.bluetooth.BluetoothGatt bluetoothGatt) {
+    private BluetoothGattWrapper(android.bluetooth.BluetoothGatt bluetoothGatt) {
         mWrappedBluetoothGatt = bluetoothGatt;
     }
 
@@ -113,10 +84,12 @@
     }
 
     /**
-     * See {@link android.bluetooth.BluetoothGatt#writeCharacteristic(BluetoothGattCharacteristic)}.
+     * See {@link android.bluetooth.BluetoothGatt#writeCharacteristic(BluetoothGattCharacteristic,
+     * byte[], int)} .
      */
-    public boolean writeCharacteristic(BluetoothGattCharacteristic characteristic) {
-        return mWrappedBluetoothGatt.writeCharacteristic(characteristic);
+    public int writeCharacteristic(BluetoothGattCharacteristic characteristic, byte[] value,
+            int writeType) {
+        return mWrappedBluetoothGatt.writeCharacteristic(characteristic, value, writeType);
     }
 
     /** See {@link android.bluetooth.BluetoothGatt#readDescriptor(BluetoothGattDescriptor)}. */
@@ -124,9 +97,12 @@
         return mWrappedBluetoothGatt.readDescriptor(descriptor);
     }
 
-    /** See {@link android.bluetooth.BluetoothGatt#writeDescriptor(BluetoothGattDescriptor)}. */
-    public boolean writeDescriptor(BluetoothGattDescriptor descriptor) {
-        return mWrappedBluetoothGatt.writeDescriptor(descriptor);
+    /**
+     * See {@link android.bluetooth.BluetoothGatt#writeDescriptor(BluetoothGattDescriptor,
+     * byte[])}.
+     */
+    public int writeDescriptor(BluetoothGattDescriptor descriptor, byte[] value) {
+        return mWrappedBluetoothGatt.writeDescriptor(descriptor, value);
     }
 
     /** See {@link android.bluetooth.BluetoothGatt#readRemoteRssi()}. */
@@ -172,10 +148,10 @@
         if (o == this) {
             return true;
         }
-        if (!(o instanceof BluetoothGatt)) {
+        if (!(o instanceof BluetoothGattWrapper)) {
             return false;
         }
-        return mWrappedBluetoothGatt.equals(((BluetoothGatt) o).unwrap());
+        return mWrappedBluetoothGatt.equals(((BluetoothGattWrapper) o).unwrap());
     }
 
     /** Unwraps a Bluetooth Gatt instance. */
@@ -184,7 +160,7 @@
     }
 
     /** Wraps a Bluetooth Gatt instance. */
-    public static BluetoothGatt wrap(android.bluetooth.BluetoothGatt gatt) {
-        return new BluetoothGatt(gatt);
+    public static BluetoothGattWrapper wrap(android.bluetooth.BluetoothGatt gatt) {
+        return new BluetoothGattWrapper(gatt);
     }
 }
diff --git a/nearby/service/java/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtils.java b/nearby/service/java/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtils.java
index 1094060..bb51920 100644
--- a/nearby/service/java/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtils.java
+++ b/nearby/service/java/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtils.java
@@ -21,11 +21,6 @@
 import android.bluetooth.BluetoothGattDescriptor;
 import android.bluetooth.BluetoothGattService;
 
-import com.android.server.nearby.common.bluetooth.BluetoothException;
-
-import java.lang.reflect.Field;
-import java.util.Arrays;
-
 import javax.annotation.Nullable;
 
 /**
@@ -65,76 +60,6 @@
         }
     }
 
-    /** Clones a {@link BluetoothGattDescriptor} so the value can be changed thread-safely. */
-    public static BluetoothGattDescriptor clone(BluetoothGattDescriptor descriptor)
-            throws BluetoothException {
-        BluetoothGattDescriptor result =
-                new BluetoothGattDescriptor(descriptor.getUuid(), descriptor.getPermissions());
-        try {
-            try {
-                // TODO(b/201463121): remove usage of reflection.
-                Field instanceIdField = BluetoothGattDescriptor.class.getDeclaredField("mInstance");
-                instanceIdField.setAccessible(true);
-                instanceIdField.set(result, instanceIdField.get(descriptor));
-            } catch (NoSuchFieldException e) {
-                // This field doesn't seem to exist in early implementation so just ignore
-                // instanceId in this case.
-            }
-
-            // TODO(b/201463121): remove usage of reflection.
-            Field characteristicField =
-                    BluetoothGattDescriptor.class.getDeclaredField("mCharacteristic");
-            characteristicField.setAccessible(true);
-            characteristicField.set(result, characteristicField.get(descriptor));
-            byte[] value = descriptor.getValue();
-            if (value != null) {
-                result.setValue(Arrays.copyOf(value, value.length));
-            }
-        } catch (NoSuchFieldException e) {
-            throw new BluetoothException("Cannot clone descriptor.", e);
-        } catch (IllegalAccessException e) {
-            throw new BluetoothException("Cannot clone descriptor.", e);
-        } catch (IllegalArgumentException e) {
-            throw new BluetoothException("Cannot clone descriptor.", e);
-        }
-        return result;
-    }
-
-    /** 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(),
-                        characteristic.getProperties(), characteristic.getPermissions());
-        try {
-            // TODO(b/201463121): remove usage of reflection.
-            Field instanceIdField = BluetoothGattCharacteristic.class.getDeclaredField("mInstance");
-            // TODO(b/201463121): remove usage of reflection.
-            Field serviceField = BluetoothGattCharacteristic.class.getDeclaredField("mService");
-            // TODO(b/201463121): remove usage of reflection.
-            Field descriptorField =
-                    BluetoothGattCharacteristic.class.getDeclaredField("mDescriptors");
-            instanceIdField.setAccessible(true);
-            serviceField.setAccessible(true);
-            descriptorField.setAccessible(true);
-            instanceIdField.set(result, instanceIdField.get(characteristic));
-            serviceField.set(result, serviceField.get(characteristic));
-            descriptorField.set(result, descriptorField.get(characteristic));
-            byte[] value = characteristic.getValue();
-            if (value != null) {
-                result.setValue(Arrays.copyOf(value, value.length));
-            }
-            result.setWriteType(characteristic.getWriteType());
-        } catch (NoSuchFieldException e) {
-            throw new BluetoothException("Cannot clone characteristic.", e);
-        } catch (IllegalAccessException e) {
-            throw new BluetoothException("Cannot clone characteristic.", e);
-        } catch (IllegalArgumentException e) {
-            throw new BluetoothException("Cannot clone characteristic.", e);
-        }
-        return result;
-    }
-
     /** Creates a user-readable string from a {@link BluetoothGattDescriptor}. */
     public static String toString(@Nullable BluetoothGattDescriptor descriptor) {
         if (descriptor == null) {
diff --git a/nearby/tests/src/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattConnectionTest.java b/nearby/tests/src/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattConnectionTest.java
index 9776836..13802ee 100644
--- a/nearby/tests/src/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattConnectionTest.java
+++ b/nearby/tests/src/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattConnectionTest.java
@@ -18,6 +18,8 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.ArgumentMatchers.isA;
@@ -33,6 +35,7 @@
 import android.bluetooth.BluetoothGattCharacteristic;
 import android.bluetooth.BluetoothGattDescriptor;
 import android.bluetooth.BluetoothGattService;
+import android.bluetooth.BluetoothStatusCodes;
 import android.os.Build.VERSION;
 import android.os.Build.VERSION_CODES;
 
@@ -43,7 +46,7 @@
 import com.android.server.nearby.common.bluetooth.gatt.BluetoothGattConnection.ChangeObserver;
 import com.android.server.nearby.common.bluetooth.gatt.BluetoothGattHelper.OperationType;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothDevice;
-import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothGatt;
+import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothGattWrapper;
 import com.android.server.nearby.common.bluetooth.util.BluetoothOperationExecutor;
 import com.android.server.nearby.common.bluetooth.util.BluetoothOperationExecutor.Operation;
 import com.android.server.nearby.common.bluetooth.util.BluetoothOperationExecutor.SynchronousOperation;
@@ -75,7 +78,7 @@
             BluetoothGattHelper.ConnectionOptions.builder().build();
 
     @Mock
-    private BluetoothGatt mMockBluetoothGatt;
+    private BluetoothGattWrapper mMockBluetoothGattWrapper;
     @Mock
     private BluetoothDevice mMockBluetoothDevice;
     @Mock
@@ -115,26 +118,31 @@
         initMocks(this);
 
         mBluetoothGattConnection = new BluetoothGattConnection(
-                mMockBluetoothGatt,
+                mMockBluetoothGattWrapper,
                 mMockBluetoothOperationExecutor,
                 CONNECTION_OPTIONS);
         mBluetoothGattConnection.onConnected();
 
-        when(mMockBluetoothGatt.getDevice()).thenReturn(mMockBluetoothDevice);
-        when(mMockBluetoothGatt.discoverServices()).thenReturn(true);
-        when(mMockBluetoothGatt.refresh()).thenReturn(true);
-        when(mMockBluetoothGatt.readCharacteristic(mMockBluetoothGattCharacteristic))
+        when(mMockBluetoothGattWrapper.getDevice()).thenReturn(mMockBluetoothDevice);
+        when(mMockBluetoothGattWrapper.discoverServices()).thenReturn(true);
+        when(mMockBluetoothGattWrapper.refresh()).thenReturn(true);
+        when(mMockBluetoothGattWrapper.readCharacteristic(mMockBluetoothGattCharacteristic))
                 .thenReturn(true);
-        when(mMockBluetoothGatt
-                .writeCharacteristic(ArgumentMatchers.<BluetoothGattCharacteristic>any()))
+        when(mMockBluetoothGattWrapper
+                .writeCharacteristic(ArgumentMatchers.<BluetoothGattCharacteristic>any(), any(),
+                        anyInt()))
+                .thenReturn(BluetoothStatusCodes.SUCCESS);
+        when(mMockBluetoothGattWrapper.readDescriptor(mMockBluetoothGattDescriptor))
                 .thenReturn(true);
-        when(mMockBluetoothGatt.readDescriptor(mMockBluetoothGattDescriptor)).thenReturn(true);
-        when(mMockBluetoothGatt.writeDescriptor(ArgumentMatchers.<BluetoothGattDescriptor>any()))
+        when(mMockBluetoothGattWrapper.writeDescriptor(
+                ArgumentMatchers.<BluetoothGattDescriptor>any(), any()))
+                .thenReturn(BluetoothStatusCodes.SUCCESS);
+        when(mMockBluetoothGattWrapper.readRemoteRssi()).thenReturn(true);
+        when(mMockBluetoothGattWrapper.requestConnectionPriority(CONNECTION_PRIORITY))
                 .thenReturn(true);
-        when(mMockBluetoothGatt.readRemoteRssi()).thenReturn(true);
-        when(mMockBluetoothGatt.requestConnectionPriority(CONNECTION_PRIORITY)).thenReturn(true);
-        when(mMockBluetoothGatt.requestMtu(MTU_REQUEST)).thenReturn(true);
-        when(mMockBluetoothGatt.getServices()).thenReturn(Arrays.asList(mMockBluetoothGattService));
+        when(mMockBluetoothGattWrapper.requestMtu(MTU_REQUEST)).thenReturn(true);
+        when(mMockBluetoothGattWrapper.getServices())
+                .thenReturn(Arrays.asList(mMockBluetoothGattService));
         when(mMockBluetoothGattService.getUuid()).thenReturn(SERVICE_UUID);
         when(mMockBluetoothGattService.getCharacteristics())
                 .thenReturn(Arrays.asList(mMockBluetoothGattCharacteristic));
@@ -171,7 +179,7 @@
 
     public void test_isConnected_false_beforeConnection() {
         mBluetoothGattConnection = new BluetoothGattConnection(
-                mMockBluetoothGatt,
+                mMockBluetoothGattWrapper,
                 mMockBluetoothOperationExecutor,
                 CONNECTION_OPTIONS);
 
@@ -205,7 +213,7 @@
         mOperationCaptor.getValue().run();
 
         assertThat(result).isEqualTo(mMockBluetoothGattService);
-        verify(mMockBluetoothGatt).discoverServices();
+        verify(mMockBluetoothGattWrapper).discoverServices();
     }
 
     public void test_getService_alreadyDiscovered() throws Exception {
@@ -222,7 +230,8 @@
     }
 
     public void test_getService_notFound() throws Exception {
-        when(mMockBluetoothGatt.getServices()).thenReturn(Arrays.<BluetoothGattService>asList());
+        when(mMockBluetoothGattWrapper.getServices()).thenReturn(
+                Arrays.<BluetoothGattService>asList());
 
         try {
             mBluetoothGattConnection.getService(SERVICE_UUID);
@@ -232,7 +241,7 @@
     }
 
     public void test_getService_moreThanOne() throws Exception {
-        when(mMockBluetoothGatt.getServices())
+        when(mMockBluetoothGattWrapper.getServices())
                 .thenReturn(Arrays.asList(mMockBluetoothGattService, mMockBluetoothGattService));
 
         try {
@@ -276,7 +285,7 @@
     public void test_getCharacteristic_moreThanOneService() throws Exception {
         // Add a new service with the same service UUID as our existing one, but add a different
         // characteristic inside of it.
-        when(mMockBluetoothGatt.getServices())
+        when(mMockBluetoothGattWrapper.getServices())
                 .thenReturn(Arrays.asList(mMockBluetoothGattService, mMockBluetoothGattService2));
         when(mMockBluetoothGattService2.getUuid()).thenReturn(SERVICE_UUID);
         when(mMockBluetoothGattService2.getCharacteristics())
@@ -345,12 +354,12 @@
                         mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.SLOW_OPERATION_TIMEOUT_MILLIS));
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).discoverServices();
-        verify(mMockBluetoothGatt, never()).refresh();
+        verify(mMockBluetoothGattWrapper).discoverServices();
+        verify(mMockBluetoothGattWrapper, never()).refresh();
     }
 
     public void test_discoverServices_serviceChange() throws Exception {
-        when(mMockBluetoothGatt.getService(ReservedUuids.Services.GENERIC_ATTRIBUTE))
+        when(mMockBluetoothGattWrapper.getService(ReservedUuids.Services.GENERIC_ATTRIBUTE))
                 .thenReturn(mMockBluetoothGattService);
         when(mMockBluetoothGattService
                 .getCharacteristic(ReservedUuids.Characteristics.SERVICE_CHANGE))
@@ -364,11 +373,11 @@
                 .execute(
                         mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.SLOW_OPERATION_TIMEOUT_MILLIS));
-        verify(mMockBluetoothGatt).refresh();
+        verify(mMockBluetoothGattWrapper).refresh();
     }
 
     public void test_discoverServices_SelfDefinedServiceDynamic() throws Exception {
-        when(mMockBluetoothGatt.getService(BluetoothConsts.SERVICE_DYNAMIC_SERVICE))
+        when(mMockBluetoothGattWrapper.getService(BluetoothConsts.SERVICE_DYNAMIC_SERVICE))
                 .thenReturn(mMockBluetoothGattService);
         when(mMockBluetoothGattService
                 .getCharacteristic(BluetoothConsts.SERVICE_DYNAMIC_CHARACTERISTIC))
@@ -382,7 +391,7 @@
                 .execute(
                         mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.SLOW_OPERATION_TIMEOUT_MILLIS));
-        verify(mMockBluetoothGatt).refresh();
+        verify(mMockBluetoothGattWrapper).refresh();
     }
 
     public void test_discoverServices_refreshWithGattErrorOnMncAbove() throws Exception {
@@ -402,7 +411,7 @@
                 .execute(
                         mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.SLOW_OPERATION_TIMEOUT_MILLIS));
-        verify(mMockBluetoothGatt).refresh();
+        verify(mMockBluetoothGattWrapper).refresh();
     }
 
     public void test_discoverServices_refreshWithGattInternalErrorOnMncAbove() throws Exception {
@@ -422,11 +431,11 @@
                 .execute(
                         mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.SLOW_OPERATION_TIMEOUT_MILLIS));
-        verify(mMockBluetoothGatt).refresh();
+        verify(mMockBluetoothGattWrapper).refresh();
     }
 
     public void test_discoverServices_dynamicServices_notBonded() throws Exception {
-        when(mMockBluetoothGatt.getService(ReservedUuids.Services.GENERIC_ATTRIBUTE))
+        when(mMockBluetoothGattWrapper.getService(ReservedUuids.Services.GENERIC_ATTRIBUTE))
                 .thenReturn(mMockBluetoothGattService);
         when(mMockBluetoothGattService
                 .getCharacteristic(ReservedUuids.Characteristics.SERVICE_CHANGE))
@@ -435,14 +444,14 @@
 
         mBluetoothGattConnection.discoverServices();
 
-        verify(mMockBluetoothGatt, never()).refresh();
+        verify(mMockBluetoothGattWrapper, never()).refresh();
     }
 
     public void test_readCharacteristic() throws Exception {
         when(mMockBluetoothOperationExecutor.executeNonnull(
                 new Operation<byte[]>(
                         OperationType.READ_CHARACTERISTIC,
-                        mMockBluetoothGatt,
+                        mMockBluetoothGattWrapper,
                         mMockBluetoothGattCharacteristic),
                 BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS))
                 .thenReturn(DATA);
@@ -454,14 +463,14 @@
         verify(mMockBluetoothOperationExecutor)
                 .executeNonnull(mOperationCaptor.capture(), anyLong());
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).readCharacteristic(mMockBluetoothGattCharacteristic);
+        verify(mMockBluetoothGattWrapper).readCharacteristic(mMockBluetoothGattCharacteristic);
     }
 
     public void test_readCharacteristic_by_uuid() throws Exception {
         when(mMockBluetoothOperationExecutor.executeNonnull(
                 new Operation<byte[]>(
                         OperationType.READ_CHARACTERISTIC,
-                        mMockBluetoothGatt,
+                        mMockBluetoothGattWrapper,
                         mMockBluetoothGattCharacteristic),
                 BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS))
                 .thenReturn(DATA);
@@ -473,7 +482,7 @@
         verify(mMockBluetoothOperationExecutor)
                 .executeNonnull(mOperationCaptor.capture(), anyLong());
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).readCharacteristic(mMockBluetoothGattCharacteristic);
+        verify(mMockBluetoothGattWrapper).readCharacteristic(mMockBluetoothGattCharacteristic);
     }
 
     public void test_writeCharacteristic() throws Exception {
@@ -486,11 +495,11 @@
                 .execute(mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS));
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).writeCharacteristic(mCharacteristicCaptor.capture());
+        verify(mMockBluetoothGattWrapper).writeCharacteristic(mCharacteristicCaptor.capture(),
+                eq(DATA), eq(characteristic.getWriteType()));
         BluetoothGattCharacteristic writtenCharacteristic = mCharacteristicCaptor.getValue();
-        assertThat(writtenCharacteristic.getValue()).isEqualTo(DATA);
         assertThat(writtenCharacteristic.getUuid()).isEqualTo(CHARACTERISTIC_UUID);
-        assertThat(writtenCharacteristic).isNotEqualTo(characteristic);
+        assertThat(writtenCharacteristic).isEqualTo(characteristic);
     }
 
     public void test_writeCharacteristic_by_uuid() throws Exception {
@@ -500,16 +509,16 @@
                 .execute(mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS));
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).writeCharacteristic(mCharacteristicCaptor.capture());
+        verify(mMockBluetoothGattWrapper).writeCharacteristic(mCharacteristicCaptor.capture(),
+                eq(DATA), anyInt());
         BluetoothGattCharacteristic writtenCharacteristic = mCharacteristicCaptor.getValue();
-        assertThat(writtenCharacteristic.getValue()).isEqualTo(DATA);
         assertThat(writtenCharacteristic.getUuid()).isEqualTo(CHARACTERISTIC_UUID);
     }
 
     public void test_readDescriptor() throws Exception {
         when(mMockBluetoothOperationExecutor.executeNonnull(
                 new Operation<byte[]>(
-                        OperationType.READ_DESCRIPTOR, mMockBluetoothGatt,
+                        OperationType.READ_DESCRIPTOR, mMockBluetoothGattWrapper,
                         mMockBluetoothGattDescriptor),
                 BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS))
                 .thenReturn(DATA);
@@ -520,13 +529,13 @@
         verify(mMockBluetoothOperationExecutor)
                 .executeNonnull(mOperationCaptor.capture(), anyLong());
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).readDescriptor(mMockBluetoothGattDescriptor);
+        verify(mMockBluetoothGattWrapper).readDescriptor(mMockBluetoothGattDescriptor);
     }
 
     public void test_readDescriptor_by_uuid() throws Exception {
         when(mMockBluetoothOperationExecutor.executeNonnull(
                 new Operation<byte[]>(
-                        OperationType.READ_DESCRIPTOR, mMockBluetoothGatt,
+                        OperationType.READ_DESCRIPTOR, mMockBluetoothGattWrapper,
                         mMockBluetoothGattDescriptor),
                 BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS))
                 .thenReturn(DATA);
@@ -539,7 +548,7 @@
         verify(mMockBluetoothOperationExecutor)
                 .executeNonnull(mOperationCaptor.capture(), anyLong());
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).readDescriptor(mMockBluetoothGattDescriptor);
+        verify(mMockBluetoothGattWrapper).readDescriptor(mMockBluetoothGattDescriptor);
     }
 
     public void test_writeDescriptor() throws Exception {
@@ -550,11 +559,10 @@
                 .execute(mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS));
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).writeDescriptor(mDescriptorCaptor.capture());
+        verify(mMockBluetoothGattWrapper).writeDescriptor(mDescriptorCaptor.capture(), eq(DATA));
         BluetoothGattDescriptor writtenDescriptor = mDescriptorCaptor.getValue();
-        assertThat(writtenDescriptor.getValue()).isEqualTo(DATA);
         assertThat(writtenDescriptor.getUuid()).isEqualTo(DESCRIPTOR_UUID);
-        assertThat(writtenDescriptor).isNotEqualTo(descriptor);
+        assertThat(writtenDescriptor).isEqualTo(descriptor);
     }
 
     public void test_writeDescriptor_by_uuid() throws Exception {
@@ -565,15 +573,14 @@
                 .execute(mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS));
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).writeDescriptor(mDescriptorCaptor.capture());
+        verify(mMockBluetoothGattWrapper).writeDescriptor(mDescriptorCaptor.capture(), eq(DATA));
         BluetoothGattDescriptor writtenDescriptor = mDescriptorCaptor.getValue();
-        assertThat(writtenDescriptor.getValue()).isEqualTo(DATA);
         assertThat(writtenDescriptor.getUuid()).isEqualTo(DESCRIPTOR_UUID);
     }
 
     public void test_readRemoteRssi() throws Exception {
         when(mMockBluetoothOperationExecutor.executeNonnull(
-                new Operation<Integer>(OperationType.READ_RSSI, mMockBluetoothGatt),
+                new Operation<Integer>(OperationType.READ_RSSI, mMockBluetoothGattWrapper),
                 BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS))
                 .thenReturn(RSSI);
 
@@ -585,7 +592,7 @@
                         mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS));
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).readRemoteRssi();
+        verify(mMockBluetoothGattWrapper).readRemoteRssi();
     }
 
     public void test_getMaxDataPacketSize() throws Exception {
@@ -600,14 +607,13 @@
 
         mBluetoothGattConnection.setNotificationEnabled(mMockBluetoothGattCharacteristic, true);
 
-        verify(mMockBluetoothGatt)
+        verify(mMockBluetoothGattWrapper)
                 .setCharacteristicNotification(mMockBluetoothGattCharacteristic, true);
         verify(mMockBluetoothOperationExecutor).execute(mOperationCaptor.capture(), anyLong());
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).writeDescriptor(mDescriptorCaptor.capture());
+        verify(mMockBluetoothGattWrapper).writeDescriptor(mDescriptorCaptor.capture(),
+                eq(BluetoothGattDescriptor.ENABLE_INDICATION_VALUE));
         BluetoothGattDescriptor writtenDescriptor = mDescriptorCaptor.getValue();
-        assertThat(writtenDescriptor.getValue())
-                .isEqualTo(BluetoothGattDescriptor.ENABLE_INDICATION_VALUE);
         assertThat(writtenDescriptor.getUuid())
                 .isEqualTo(ReservedUuids.Descriptors.CLIENT_CHARACTERISTIC_CONFIGURATION);
     }
@@ -615,14 +621,13 @@
     public void test_getNotificationEnabled_notification_enable() throws Exception {
         mBluetoothGattConnection.setNotificationEnabled(mMockBluetoothGattCharacteristic, true);
 
-        verify(mMockBluetoothGatt)
+        verify(mMockBluetoothGattWrapper)
                 .setCharacteristicNotification(mMockBluetoothGattCharacteristic, true);
         verify(mMockBluetoothOperationExecutor).execute(mOperationCaptor.capture(), anyLong());
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).writeDescriptor(mDescriptorCaptor.capture());
+        verify(mMockBluetoothGattWrapper).writeDescriptor(mDescriptorCaptor.capture(),
+                eq(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE));
         BluetoothGattDescriptor writtenDescriptor = mDescriptorCaptor.getValue();
-        assertThat(writtenDescriptor.getValue())
-                .isEqualTo(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
         assertThat(writtenDescriptor.getUuid())
                 .isEqualTo(ReservedUuids.Descriptors.CLIENT_CHARACTERISTIC_CONFIGURATION);
     }
@@ -633,14 +638,13 @@
 
         mBluetoothGattConnection.setNotificationEnabled(mMockBluetoothGattCharacteristic, false);
 
-        verify(mMockBluetoothGatt)
+        verify(mMockBluetoothGattWrapper)
                 .setCharacteristicNotification(mMockBluetoothGattCharacteristic, false);
         verify(mMockBluetoothOperationExecutor).execute(mOperationCaptor.capture(), anyLong());
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).writeDescriptor(mDescriptorCaptor.capture());
+        verify(mMockBluetoothGattWrapper).writeDescriptor(mDescriptorCaptor.capture(),
+                eq(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE));
         BluetoothGattDescriptor writtenDescriptor = mDescriptorCaptor.getValue();
-        assertThat(writtenDescriptor.getValue())
-                .isEqualTo(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
         assertThat(writtenDescriptor.getUuid())
                 .isEqualTo(ReservedUuids.Descriptors.CLIENT_CHARACTERISTIC_CONFIGURATION);
     }
@@ -648,14 +652,13 @@
     public void test_setNotificationEnabled_notification_disable() throws Exception {
         mBluetoothGattConnection.setNotificationEnabled(mMockBluetoothGattCharacteristic, false);
 
-        verify(mMockBluetoothGatt)
+        verify(mMockBluetoothGattWrapper)
                 .setCharacteristicNotification(mMockBluetoothGattCharacteristic, false);
         verify(mMockBluetoothOperationExecutor).execute(mOperationCaptor.capture(), anyLong());
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).writeDescriptor(mDescriptorCaptor.capture());
+        verify(mMockBluetoothGattWrapper).writeDescriptor(mDescriptorCaptor.capture(),
+                eq(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE));
         BluetoothGattDescriptor writtenDescriptor = mDescriptorCaptor.getValue();
-        assertThat(writtenDescriptor.getValue())
-                .isEqualTo(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
         assertThat(writtenDescriptor.getUuid())
                 .isEqualTo(ReservedUuids.Descriptors.CLIENT_CHARACTERISTIC_CONFIGURATION);
     }
@@ -665,7 +668,8 @@
                 .thenReturn(BluetoothGattCharacteristic.PROPERTY_READ);
 
         try {
-            mBluetoothGattConnection.setNotificationEnabled(mMockBluetoothGattCharacteristic, true);
+            mBluetoothGattConnection.setNotificationEnabled(mMockBluetoothGattCharacteristic,
+                    true);
             fail("BluetoothException was expected");
         } catch (BluetoothException expected) {
         }
@@ -782,8 +786,8 @@
                 .execute(mOperationCaptor.capture(),
                         eq(BluetoothGattConnection.OPERATION_TIMEOUT_MILLIS));
         mOperationCaptor.getValue().run();
-        verify(mMockBluetoothGatt).disconnect();
-        verify(mMockBluetoothGatt).close();
+        verify(mMockBluetoothGattWrapper).disconnect();
+        verify(mMockBluetoothGattWrapper).close();
     }
 
     public void test_onClosed() throws Exception {
@@ -791,6 +795,6 @@
 
         verify(mMockBluetoothOperationExecutor, never())
                 .execute(mOperationCaptor.capture(), anyLong());
-        verify(mMockBluetoothGatt).close();
+        verify(mMockBluetoothGattWrapper).close();
     }
 }
diff --git a/nearby/tests/src/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattHelperTest.java b/nearby/tests/src/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattHelperTest.java
index a60f0b2..60cac57 100644
--- a/nearby/tests/src/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattHelperTest.java
+++ b/nearby/tests/src/com/android/server/nearby/common/bluetooth/gatt/BluetoothGattHelperTest.java
@@ -33,6 +33,7 @@
 import static org.mockito.Mockito.when;
 import static org.mockito.MockitoAnnotations.initMocks;
 
+import android.bluetooth.BluetoothGatt;
 import android.bluetooth.BluetoothGattCharacteristic;
 import android.bluetooth.BluetoothGattDescriptor;
 import android.bluetooth.le.ScanFilter;
@@ -46,7 +47,7 @@
 import com.android.server.nearby.common.bluetooth.gatt.BluetoothGattHelper.OperationType;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothAdapter;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothDevice;
-import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothGatt;
+import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.BluetoothGattWrapper;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.le.BluetoothLeScanner;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.le.ScanCallback;
 import com.android.server.nearby.common.bluetooth.testability.android.bluetooth.le.ScanResult;
@@ -90,7 +91,7 @@
     @Mock
     private BluetoothGattConnection mMockBluetoothGattConnection;
     @Mock
-    private BluetoothGatt mMockBluetoothGatt;
+    private BluetoothGattWrapper mMockBluetoothGattWrapper;
     @Mock
     private BluetoothGattCharacteristic mMockBluetoothGattCharacteristic;
     @Mock
@@ -132,12 +133,13 @@
         when(mMockBluetoothGattCharacteristic.getValue()).thenReturn(CHARACTERISTIC_VALUE);
         when(mMockBluetoothGattDescriptor.getValue()).thenReturn(DESCRIPTOR_VALUE);
         when(mMockScanResult.getDevice()).thenReturn(mMockBluetoothDevice);
-        when(mMockBluetoothGatt.getDevice()).thenReturn(mMockBluetoothDevice);
+        when(mMockBluetoothGattWrapper.getDevice()).thenReturn(mMockBluetoothDevice);
         when(mMockBluetoothDevice.connectGatt(eq(mMockApplicationContext), anyBoolean(),
-                eq(mBluetoothGattHelper.mBluetoothGattCallback))).thenReturn(mMockBluetoothGatt);
+                eq(mBluetoothGattHelper.mBluetoothGattCallback))).thenReturn(
+                mMockBluetoothGattWrapper);
         when(mMockBluetoothDevice.connectGatt(eq(mMockApplicationContext), anyBoolean(),
                 eq(mBluetoothGattHelper.mBluetoothGattCallback), anyInt()))
-                .thenReturn(mMockBluetoothGatt);
+                .thenReturn(mMockBluetoothGattWrapper);
         when(mMockBluetoothGattConnection.getConnectionOptions())
                 .thenReturn(ConnectionOptions.builder().build());
     }
@@ -245,7 +247,7 @@
         verify(mMockBluetoothDevice).connectGatt(mMockApplicationContext, false,
                 mBluetoothGattHelper.mBluetoothGattCallback,
                 android.bluetooth.BluetoothDevice.TRANSPORT_LE);
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt).getDevice())
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper).getDevice())
                 .isEqualTo(mMockBluetoothDevice);
     }
 
@@ -263,7 +265,8 @@
         verify(mMockBluetoothDevice).connectGatt(mMockApplicationContext, true,
                 mBluetoothGattHelper.mBluetoothGattCallback,
                 android.bluetooth.BluetoothDevice.TRANSPORT_LE);
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt).getConnectionOptions())
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper)
+                .getConnectionOptions())
                 .isEqualTo(ConnectionOptions.builder()
                         .setAutoConnect(true)
                         .build());
@@ -290,7 +293,8 @@
 
     public void test_connect_withOptionRequestConnectionPriority_success() throws Exception {
         // Operation succeeds on the 3rd try.
-        when(mMockBluetoothGatt.requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_HIGH))
+        when(mMockBluetoothGattWrapper
+                .requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_HIGH))
                 .thenReturn(false)
                 .thenReturn(false)
                 .thenReturn(true);
@@ -309,11 +313,12 @@
         verify(mMockBluetoothDevice).connectGatt(mMockApplicationContext, false,
                 mBluetoothGattHelper.mBluetoothGattCallback,
                 android.bluetooth.BluetoothDevice.TRANSPORT_LE);
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt).getConnectionOptions())
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper)
+                .getConnectionOptions())
                 .isEqualTo(ConnectionOptions.builder()
                         .setConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_HIGH)
                         .build());
-        verify(mMockBluetoothGatt, times(3))
+        verify(mMockBluetoothGattWrapper, times(3))
                 .requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_HIGH);
     }
 
@@ -326,16 +331,18 @@
         operation.run();
         operation.cancel();
 
-        verify(mMockBluetoothGatt).disconnect();
-        verify(mMockBluetoothGatt).close();
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt)).isNull();
+        verify(mMockBluetoothGattWrapper).disconnect();
+        verify(mMockBluetoothGattWrapper).close();
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper)).isNull();
     }
 
     public void test_BluetoothGattCallback_onConnectionStateChange_connected_success()
             throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
 
-        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(
+                mMockBluetoothGattWrapper,
                 BluetoothGatt.GATT_SUCCESS, BluetoothGatt.STATE_CONNECTED);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(
@@ -347,45 +354,50 @@
 
     public void test_BluetoothGattCallback_onConnectionStateChange_connected_success_withMtuOption()
             throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
         when(mMockBluetoothGattConnection.getConnectionOptions())
                 .thenReturn(BluetoothGattHelper.ConnectionOptions.builder()
                         .setMtu(MTU)
                         .build());
-        when(mMockBluetoothGatt.requestMtu(MTU)).thenReturn(true);
+        when(mMockBluetoothGattWrapper.requestMtu(MTU)).thenReturn(true);
 
-        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(
+                mMockBluetoothGattWrapper,
                 BluetoothGatt.GATT_SUCCESS, BluetoothGatt.STATE_CONNECTED);
 
         verifyZeroInteractions(mMockBluetoothOperationExecutor);
         verify(mMockBluetoothGattConnection, never()).onConnected();
-        verify(mMockBluetoothGatt).requestMtu(MTU);
+        verify(mMockBluetoothGattWrapper).requestMtu(MTU);
     }
 
     public void test_BluetoothGattCallback_onConnectionStateChange_connected_success_failMtuOption()
             throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
         when(mMockBluetoothGattConnection.getConnectionOptions())
                 .thenReturn(BluetoothGattHelper.ConnectionOptions.builder()
                         .setMtu(MTU)
                         .build());
-        when(mMockBluetoothGatt.requestMtu(MTU)).thenReturn(false);
+        when(mMockBluetoothGattWrapper.requestMtu(MTU)).thenReturn(false);
 
-        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(
+                mMockBluetoothGattWrapper,
                 BluetoothGatt.GATT_SUCCESS, BluetoothGatt.STATE_CONNECTED);
 
         verify(mMockBluetoothOperationExecutor).notifyFailure(
                 eq(new Operation<>(OperationType.CONNECT, mMockBluetoothDevice)),
                 any(BluetoothException.class));
         verify(mMockBluetoothGattConnection, never()).onConnected();
-        verify(mMockBluetoothGatt).disconnect();
-        verify(mMockBluetoothGatt).close();
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt)).isNull();
+        verify(mMockBluetoothGattWrapper).disconnect();
+        verify(mMockBluetoothGattWrapper).close();
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper)).isNull();
     }
 
     public void test_BluetoothGattCallback_onConnectionStateChange_connected_unexpectedSuccess()
             throws Exception {
-        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(
+                mMockBluetoothGattWrapper,
                 BluetoothGatt.GATT_SUCCESS, BluetoothGatt.STATE_CONNECTED);
 
         verifyZeroInteractions(mMockBluetoothOperationExecutor);
@@ -393,11 +405,12 @@
 
     public void test_BluetoothGattCallback_onConnectionStateChange_connected_failure()
             throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
 
         mBluetoothGattHelper.mBluetoothGattCallback
                 .onConnectionStateChange(
-                        mMockBluetoothGatt,
+                        mMockBluetoothGattWrapper,
                         BluetoothGatt.GATT_FAILURE,
                         BluetoothGatt.STATE_CONNECTED);
 
@@ -406,16 +419,16 @@
                         new Operation<>(OperationType.CONNECT, mMockBluetoothDevice),
                         BluetoothGatt.GATT_FAILURE,
                         null);
-        verify(mMockBluetoothGatt).disconnect();
-        verify(mMockBluetoothGatt).close();
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt)).isNull();
+        verify(mMockBluetoothGattWrapper).disconnect();
+        verify(mMockBluetoothGattWrapper).close();
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper)).isNull();
     }
 
     public void test_BluetoothGattCallback_onConnectionStateChange_disconnected_unexpectedSuccess()
             throws Exception {
         mBluetoothGattHelper.mBluetoothGattCallback
                 .onConnectionStateChange(
-                        mMockBluetoothGatt,
+                        mMockBluetoothGattWrapper,
                         BluetoothGatt.GATT_SUCCESS,
                         BluetoothGatt.STATE_DISCONNECTED);
 
@@ -424,12 +437,13 @@
 
     public void test_BluetoothGattCallback_onConnectionStateChange_disconnected_notConnected()
             throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
         when(mMockBluetoothGattConnection.isConnected()).thenReturn(false);
 
         mBluetoothGattHelper.mBluetoothGattCallback
                 .onConnectionStateChange(
-                        mMockBluetoothGatt,
+                        mMockBluetoothGattWrapper,
                         GATT_STATUS,
                         BluetoothGatt.STATE_DISCONNECTED);
 
@@ -438,125 +452,135 @@
                         new Operation<>(OperationType.CONNECT, mMockBluetoothDevice),
                         GATT_STATUS,
                         null);
-        verify(mMockBluetoothGatt).disconnect();
-        verify(mMockBluetoothGatt).close();
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt)).isNull();
+        verify(mMockBluetoothGattWrapper).disconnect();
+        verify(mMockBluetoothGattWrapper).close();
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper)).isNull();
     }
 
     public void test_BluetoothGattCallback_onConnectionStateChange_disconnected_success()
             throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
         when(mMockBluetoothGattConnection.isConnected()).thenReturn(true);
 
-        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(
+                mMockBluetoothGattWrapper,
                 BluetoothGatt.GATT_SUCCESS, BluetoothGatt.STATE_DISCONNECTED);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(
                 new Operation<>(OperationType.DISCONNECT, mMockBluetoothDevice),
                 BluetoothGatt.GATT_SUCCESS);
         verify(mMockBluetoothGattConnection).onClosed();
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt)).isNull();
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper)).isNull();
     }
 
     public void test_BluetoothGattCallback_onConnectionStateChange_disconnected_failure()
             throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
         when(mMockBluetoothGattConnection.isConnected()).thenReturn(true);
 
-        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onConnectionStateChange(
+                mMockBluetoothGattWrapper,
                 BluetoothGatt.GATT_FAILURE, BluetoothGatt.STATE_DISCONNECTED);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(
                 new Operation<>(OperationType.DISCONNECT, mMockBluetoothDevice),
                 BluetoothGatt.GATT_FAILURE);
         verify(mMockBluetoothGattConnection).onClosed();
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt)).isNull();
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper)).isNull();
     }
 
     public void test_BluetoothGattCallback_onServicesDiscovered() throws Exception {
-        mBluetoothGattHelper.mBluetoothGattCallback.onServicesDiscovered(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onServicesDiscovered(mMockBluetoothGattWrapper,
                 GATT_STATUS);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(
-                new Operation<Void>(OperationType.DISCOVER_SERVICES_INTERNAL, mMockBluetoothGatt),
+                new Operation<Void>(OperationType.DISCOVER_SERVICES_INTERNAL,
+                        mMockBluetoothGattWrapper),
                 GATT_STATUS);
     }
 
     public void test_BluetoothGattCallback_onCharacteristicRead() throws Exception {
-        mBluetoothGattHelper.mBluetoothGattCallback.onCharacteristicRead(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onCharacteristicRead(mMockBluetoothGattWrapper,
                 mMockBluetoothGattCharacteristic, GATT_STATUS);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(new Operation<byte[]>(
-                        OperationType.READ_CHARACTERISTIC, mMockBluetoothGatt,
+                        OperationType.READ_CHARACTERISTIC, mMockBluetoothGattWrapper,
                         mMockBluetoothGattCharacteristic),
                 GATT_STATUS, CHARACTERISTIC_VALUE);
     }
 
     public void test_BluetoothGattCallback_onCharacteristicWrite() throws Exception {
-        mBluetoothGattHelper.mBluetoothGattCallback.onCharacteristicWrite(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onCharacteristicWrite(mMockBluetoothGattWrapper,
                 mMockBluetoothGattCharacteristic, GATT_STATUS);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(new Operation<Void>(
-                        OperationType.WRITE_CHARACTERISTIC, mMockBluetoothGatt,
+                        OperationType.WRITE_CHARACTERISTIC, mMockBluetoothGattWrapper,
                         mMockBluetoothGattCharacteristic),
                 GATT_STATUS);
     }
 
     public void test_BluetoothGattCallback_onDescriptorRead() throws Exception {
-        mBluetoothGattHelper.mBluetoothGattCallback.onDescriptorRead(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onDescriptorRead(mMockBluetoothGattWrapper,
                 mMockBluetoothGattDescriptor, GATT_STATUS);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(new Operation<byte[]>(
-                        OperationType.READ_DESCRIPTOR, mMockBluetoothGatt,
+                        OperationType.READ_DESCRIPTOR, mMockBluetoothGattWrapper,
                         mMockBluetoothGattDescriptor),
                 GATT_STATUS,
                 DESCRIPTOR_VALUE);
     }
 
     public void test_BluetoothGattCallback_onDescriptorWrite() throws Exception {
-        mBluetoothGattHelper.mBluetoothGattCallback.onDescriptorWrite(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onDescriptorWrite(mMockBluetoothGattWrapper,
                 mMockBluetoothGattDescriptor, GATT_STATUS);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(new Operation<Void>(
-                        OperationType.WRITE_DESCRIPTOR, mMockBluetoothGatt,
+                        OperationType.WRITE_DESCRIPTOR, mMockBluetoothGattWrapper,
                         mMockBluetoothGattDescriptor),
                 GATT_STATUS);
     }
 
     public void test_BluetoothGattCallback_onReadRemoteRssi() throws Exception {
-        mBluetoothGattHelper.mBluetoothGattCallback.onReadRemoteRssi(mMockBluetoothGatt, RSSI,
-                GATT_STATUS);
+        mBluetoothGattHelper.mBluetoothGattCallback.onReadRemoteRssi(mMockBluetoothGattWrapper,
+                RSSI, GATT_STATUS);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(
-                new Operation<Integer>(OperationType.READ_RSSI, mMockBluetoothGatt), GATT_STATUS,
-                RSSI);
+                new Operation<Integer>(OperationType.READ_RSSI, mMockBluetoothGattWrapper),
+                GATT_STATUS, RSSI);
     }
 
     public void test_BluetoothGattCallback_onReliableWriteCompleted() throws Exception {
-        mBluetoothGattHelper.mBluetoothGattCallback.onReliableWriteCompleted(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onReliableWriteCompleted(
+                mMockBluetoothGattWrapper,
                 GATT_STATUS);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(
-                new Operation<Void>(OperationType.WRITE_RELIABLE, mMockBluetoothGatt), GATT_STATUS);
+                new Operation<Void>(OperationType.WRITE_RELIABLE, mMockBluetoothGattWrapper),
+                GATT_STATUS);
     }
 
     public void test_BluetoothGattCallback_onMtuChanged() throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
         when(mMockBluetoothGattConnection.isConnected()).thenReturn(true);
 
         mBluetoothGattHelper.mBluetoothGattCallback
-                .onMtuChanged(mMockBluetoothGatt, MTU, GATT_STATUS);
+                .onMtuChanged(mMockBluetoothGattWrapper, MTU, GATT_STATUS);
 
         verify(mMockBluetoothOperationExecutor).notifyCompletion(
-                new Operation<>(OperationType.CHANGE_MTU, mMockBluetoothGatt), GATT_STATUS, MTU);
+                new Operation<>(OperationType.CHANGE_MTU, mMockBluetoothGattWrapper), GATT_STATUS,
+                MTU);
     }
 
     public void testBluetoothGattCallback_onMtuChangedDuringConnection_success() throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
         when(mMockBluetoothGattConnection.isConnected()).thenReturn(false);
 
         mBluetoothGattHelper.mBluetoothGattCallback.onMtuChanged(
-                mMockBluetoothGatt, MTU, BluetoothGatt.GATT_SUCCESS);
+                mMockBluetoothGattWrapper, MTU, BluetoothGatt.GATT_SUCCESS);
 
         verify(mMockBluetoothGattConnection).onConnected();
         verify(mMockBluetoothOperationExecutor)
@@ -567,11 +591,12 @@
     }
 
     public void testBluetoothGattCallback_onMtuChangedDuringConnection_fail() throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
         when(mMockBluetoothGattConnection.isConnected()).thenReturn(false);
 
         mBluetoothGattHelper.mBluetoothGattCallback
-                .onMtuChanged(mMockBluetoothGatt, MTU, GATT_STATUS);
+                .onMtuChanged(mMockBluetoothGattWrapper, MTU, GATT_STATUS);
 
         verify(mMockBluetoothGattConnection).onConnected();
         verify(mMockBluetoothOperationExecutor)
@@ -579,15 +604,17 @@
                         new Operation<>(OperationType.CONNECT, mMockBluetoothDevice),
                         GATT_STATUS,
                         mMockBluetoothGattConnection);
-        verify(mMockBluetoothGatt).disconnect();
-        verify(mMockBluetoothGatt).close();
-        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGatt)).isNull();
+        verify(mMockBluetoothGattWrapper).disconnect();
+        verify(mMockBluetoothGattWrapper).close();
+        assertThat(mBluetoothGattHelper.mConnections.get(mMockBluetoothGattWrapper)).isNull();
     }
 
     public void test_BluetoothGattCallback_onCharacteristicChanged() throws Exception {
-        mBluetoothGattHelper.mConnections.put(mMockBluetoothGatt, mMockBluetoothGattConnection);
+        mBluetoothGattHelper.mConnections.put(mMockBluetoothGattWrapper,
+                mMockBluetoothGattConnection);
 
-        mBluetoothGattHelper.mBluetoothGattCallback.onCharacteristicChanged(mMockBluetoothGatt,
+        mBluetoothGattHelper.mBluetoothGattCallback.onCharacteristicChanged(
+                mMockBluetoothGattWrapper,
                 mMockBluetoothGattCharacteristic);
 
         verify(mMockBluetoothGattConnection).onCharacteristicChanged(
diff --git a/nearby/tests/src/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtilsTest.java b/nearby/tests/src/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtilsTest.java
index a6fbe2a..53c7615 100644
--- a/nearby/tests/src/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtilsTest.java
+++ b/nearby/tests/src/com/android/server/nearby/common/bluetooth/util/BluetoothGattUtilsTest.java
@@ -21,16 +21,11 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.bluetooth.BluetoothGatt;
-import android.bluetooth.BluetoothGattCharacteristic;
-import android.bluetooth.BluetoothGattDescriptor;
-import android.bluetooth.BluetoothGattService;
 import android.platform.test.annotations.Presubmit;
 
 import androidx.test.filters.SmallTest;
 import androidx.test.runner.AndroidJUnit4;
 
-import com.android.server.nearby.common.bluetooth.BluetoothException;
-
 import com.google.common.collect.ImmutableSet;
 
 import org.junit.Test;
@@ -65,41 +60,4 @@
             assertThat(getMessageForStatusCode(fieldValue)).isEqualTo(fieldName);
         }
     }
-
-    @Test
-    public void testCloneDescriptor() throws BluetoothException {
-        BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(TEST_UUID,
-                BluetoothGattCharacteristic.PROPERTY_INDICATE,
-                BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED
-                        | BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED_MITM);
-        BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor(TEST_UUID,
-                BluetoothGattDescriptor.PERMISSION_READ_ENCRYPTED
-                        | BluetoothGattDescriptor.PERMISSION_WRITE_SIGNED_MITM);
-        characteristic.addDescriptor(descriptor);
-
-        BluetoothGattDescriptor result = BluetoothGattUtils.clone(descriptor);
-
-        assertThat(result.getUuid()).isEqualTo(descriptor.getUuid());
-        assertThat(result.getPermissions()).isEqualTo(descriptor.getPermissions());
-        assertThat(result.getCharacteristic()).isEqualTo(descriptor.getCharacteristic());
-    }
-
-    @Test
-    public void testCloneCharacteristic() throws BluetoothException {
-        BluetoothGattService service =
-                new BluetoothGattService(TEST_UUID, BluetoothGattService.SERVICE_TYPE_PRIMARY);
-        BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(TEST_UUID,
-                BluetoothGattCharacteristic.PROPERTY_INDICATE,
-                BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED
-                        | BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED_MITM);
-        characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT);
-        service.addCharacteristic(characteristic);
-        BluetoothGattCharacteristic result = BluetoothGattUtils.clone(characteristic);
-
-        assertThat(result.getUuid()).isEqualTo(characteristic.getUuid());
-        assertThat(result.getPermissions()).isEqualTo(characteristic.getPermissions());
-        assertThat(result.getProperties()).isEqualTo(characteristic.getProperties());
-        assertThat(result.getService()).isEqualTo(characteristic.getService());
-        assertThat(result.getInstanceId()).isEqualTo(characteristic.getInstanceId());
-        assertThat(result.getWriteType()).isEqualTo(characteristic.getWriteType());    }
 }
