OSDN Git Service

Fix bug where GATT descriptors weren't being added to right characteristic
authorMike J. Chen <mjchen@google.com>
Tue, 24 Jun 2014 17:19:45 +0000 (10:19 -0700)
committerMike J. Chen <mjchen@google.com>
Tue, 24 Jun 2014 17:19:45 +0000 (10:19 -0700)
When there's more than one characteristic with the same UUID in
a service, the descriptors for the non-zero instanceID characteristics
were being assigned to the zero instanceID one, so descriptor
fetching wouldn't work.  This is particularly bad for HID devices
since separate reports would show up as multiple characteristics
with the same UUID but there'd be no way to identify them
without their descriptor attributes.

Change-Id: I92bb4be34aa941dd3c6750874bef2e8a261ded92
Signed-off-by: Mike J. Chen <mjchen@google.com>
core/java/android/bluetooth/BluetoothGatt.java

index c9df9c0..7b5bfbd 100644 (file)
@@ -267,7 +267,7 @@ public final class BluetoothGatt implements BluetoothProfile {
                 if (service == null) return;
 
                 BluetoothGattCharacteristic characteristic = service.getCharacteristic(
-                    charUuid.getUuid());
+                    charUuid.getUuid(), charInstId);
                 if (characteristic == null) return;
 
                 characteristic.addDescriptor(new BluetoothGattDescriptor(