diff options
author | Scott Lobdell <slobdell@google.com> | 2022-03-25 17:35:54 +0000 |
---|---|---|
committer | Scott Lobdell <slobdell@google.com> | 2022-03-25 17:47:54 +0000 |
commit | 8d4d459a97c4d14422610cece6b2e57ff8f5b8a8 (patch) | |
tree | 54c9d7e0ca4a5299bb2a7d7e3a24fa296a2ef31a /framework/java/android/bluetooth/BluetoothGatt.java | |
parent | 716968a4d1de6971c5c569cd8f5f2830b5dba575 (diff) | |
parent | a555ad5019f215e6ac56359a02a6e95713dd0c89 (diff) |
Merge TP1A.220321.002
Change-Id: Ie8206e8b9c11c3fd55b7adddac5c782ad92c9da4
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothGatt.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothGatt.java | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/framework/java/android/bluetooth/BluetoothGatt.java b/framework/java/android/bluetooth/BluetoothGatt.java index b0864baf04..8036311c20 100644 --- a/framework/java/android/bluetooth/BluetoothGatt.java +++ b/framework/java/android/bluetooth/BluetoothGatt.java @@ -23,6 +23,7 @@ import android.annotation.NonNull; import android.annotation.RequiresNoPermission; import android.annotation.RequiresPermission; import android.annotation.SuppressLint; +import android.bluetooth.BluetoothGattCharacteristic.WriteType; import android.bluetooth.annotations.RequiresBluetoothConnectPermission; import android.bluetooth.annotations.RequiresLegacyBluetoothPermission; import android.compat.annotation.UnsupportedAppUsage; @@ -423,9 +424,6 @@ public final class BluetoothGatt implements BluetoothProfile { if (status == 0) characteristic.setValue(value); callback.onCharacteristicRead(BluetoothGatt.this, characteristic, value, status); - // Keep calling deprecated callback to maintain app compatibility - callback.onCharacteristicRead(BluetoothGatt.this, characteristic, - status); } } }); @@ -526,9 +524,6 @@ public final class BluetoothGatt implements BluetoothProfile { characteristic.setValue(value); callback.onCharacteristicChanged(BluetoothGatt.this, characteristic, value); - // Keep calling deprecated callback to maintain app compatibility - callback.onCharacteristicChanged(BluetoothGatt.this, - characteristic); } } }); @@ -585,8 +580,6 @@ public final class BluetoothGatt implements BluetoothProfile { if (status == 0) descriptor.setValue(value); callback.onDescriptorRead(BluetoothGatt.this, descriptor, status, value); - // Keep calling deprecated callback to maintain app compatibility - callback.onDescriptorRead(BluetoothGatt.this, descriptor, status); } } }); @@ -1341,7 +1334,6 @@ public final class BluetoothGatt implements BluetoothProfile { return true; } - /** * Writes a given characteristic and its values to the associated remote device. * @@ -1354,7 +1346,8 @@ public final class BluetoothGatt implements BluetoothProfile { * @throws IllegalArgumentException if characteristic or its value are null * * @deprecated Use {@link BluetoothGatt#writeCharacteristic(BluetoothGattCharacteristic, byte[], - * int)} as this is not memory safe. + * int)} as this is not memory safe because it relies on a {@link BluetoothGattCharacteristic} + * object whose underlying fields are subject to change outside this method. */ @Deprecated @RequiresLegacyBluetoothPermission @@ -1374,7 +1367,6 @@ public final class BluetoothGatt implements BluetoothProfile { @IntDef(value = { BluetoothStatusCodes.SUCCESS, BluetoothStatusCodes.ERROR_MISSING_BLUETOOTH_CONNECT_PERMISSION, - BluetoothStatusCodes.ERROR_MISSING_BLUETOOTH_PRIVILEGED_PERMISSION, BluetoothStatusCodes.ERROR_DEVICE_NOT_CONNECTED, BluetoothStatusCodes.ERROR_PROFILE_SERVICE_NOT_BOUND, BluetoothStatusCodes.ERROR_GATT_WRITE_NOT_ALLOWED, @@ -1398,7 +1390,7 @@ public final class BluetoothGatt implements BluetoothProfile { @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) @WriteOperationReturnValues public int writeCharacteristic(@NonNull BluetoothGattCharacteristic characteristic, - @NonNull byte[] value, int writeType) { + @NonNull byte[] value, @WriteType int writeType) { if (characteristic == null) { throw new IllegalArgumentException("characteristic must not be null"); } @@ -1523,7 +1515,8 @@ public final class BluetoothGatt implements BluetoothProfile { * @throws IllegalArgumentException if descriptor or its value are null * * @deprecated Use {@link BluetoothGatt#writeDescriptor(BluetoothGattDescriptor, byte[])} as - * this is not memory safe. + * this is not memory safe because it relies on a {@link BluetoothGattDescriptor} object + * whose underlying fields are subject to change outside this method. */ @Deprecated @RequiresLegacyBluetoothPermission |