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

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

Issue 1712593002: bluetooth: android: Confirm the notify session after the descriptor has been written. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Vincent's comments Created 4 years, 10 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
Index: device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java
diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java
index 88e290f41d7fb6d751fbce861735f768dfecd92a..b7fd6a1d20a13303ea64a4666bfd2c94a8962ede 100644
--- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java
+++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java
@@ -255,6 +255,44 @@ final class ChromeBluetoothDevice {
}
});
}
+
+ @Override
+ public void onDescriptorRead(
+ final Wrappers.BluetoothGattDescriptorWrapper descriptor, final int status) {
+ ThreadUtils.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ ChromeBluetoothRemoteGattDescriptor chromeDescriptor =
+ mWrapperToChromeDescriptorsMap.get(descriptor);
+ if (chromeDescriptor == null) {
+ // Android events arriving with no Chrome object is expected rarely: only
+ // when the event races object destruction.
+ Log.v(TAG, "onDescriptorRead when chromeDescriptor == null.");
+ } else {
+ chromeDescriptor.onDescriptorRead(status);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onDescriptorWrite(
+ final Wrappers.BluetoothGattDescriptorWrapper descriptor, final int status) {
+ ThreadUtils.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ ChromeBluetoothRemoteGattDescriptor chromeDescriptor =
+ mWrapperToChromeDescriptorsMap.get(descriptor);
+ if (chromeDescriptor == null) {
+ // Android events arriving with no Chrome object is expected rarely: only
+ // when the event races object destruction.
+ Log.v(TAG, "onDescriptorWrite when chromeDescriptor == null.");
+ } else {
+ chromeDescriptor.onDescriptorWrite(status);
+ }
+ }
+ });
+ }
}
// ---------------------------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698