diff options
Diffstat (limited to 'device/bluetooth/android/java/src')
2 files changed, 8 insertions, 19 deletions
diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java index 6d19c1f..7d6c50f 100644 --- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java +++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java @@ -148,10 +148,15 @@ final class ChromeBluetoothRemoteGattCharacteristic { private void createDescriptors() { List<Wrappers.BluetoothGattDescriptorWrapper> descriptors = mCharacteristic.getDescriptors(); + // descriptorInstanceId ensures duplicate UUIDs have unique instance + // IDs. BluetoothGattDescriptor does not offer getInstanceId the way + // BluetoothGattCharacteristic does. + // + // TODO(crbug.com/576906) Do not reuse IDs upon onServicesDiscovered. + int instanceIdCounter = 0; for (Wrappers.BluetoothGattDescriptorWrapper descriptor : descriptors) { - // Create an adapter unique descriptor ID. - // TODO(crbug.com/576900) Unique descriptorInstanceId duplicate UUID values. - String descriptorInstanceId = mInstanceId + "/" + descriptor.getUuid().toString(); + String descriptorInstanceId = + mInstanceId + "/" + descriptor.getUuid().toString() + ";" + instanceIdCounter++; nativeCreateGattRemoteDescriptor(mNativeBluetoothRemoteGattCharacteristicAndroid, descriptorInstanceId, descriptor, mChromeDevice); } diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java index b61c7cd..2cc705d 100644 --- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java +++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java @@ -517,22 +517,6 @@ class Wrappers { mDeviceWrapper = deviceWrapper; } - public BluetoothGattDescriptorWrapper getDescriptor(UUID uuid) { - BluetoothGattDescriptor descriptor = mCharacteristic.getDescriptor(uuid); - if (descriptor == null) { - return null; - } - - BluetoothGattDescriptorWrapper descriptorWrapper = - mDeviceWrapper.mDescriptorsToWrappers.get(descriptor); - - if (descriptorWrapper == null) { - descriptorWrapper = new BluetoothGattDescriptorWrapper(descriptor, mDeviceWrapper); - mDeviceWrapper.mDescriptorsToWrappers.put(descriptor, descriptorWrapper); - } - return descriptorWrapper; - } - public List<BluetoothGattDescriptorWrapper> getDescriptors() { List<BluetoothGattDescriptor> descriptors = mCharacteristic.getDescriptors(); |