Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java

Issue 1765773002: bluetooth: Refactor GetDescriptorForUUID to GetDescriptorsForUUID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-notify-tommyt-
Patch Set: addressed ortuno's comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java
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 6d19c1f5c164b998025f236e11cb78d87cae0cf9..7d6c50fe381793986e50529a9796adb6cc834da3 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);
}
« no previous file with comments | « no previous file | device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698