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

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

Issue 1502833002: bluetooth: android: Enable characteristic change notification events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-check-null-
Patch Set: addressed jyasskin Created 4 years, 11 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 81742c5914fc8863b816f2f487a4fb4d45413102..6b163d828a2969461823ec1590fbb9d4d8e4a630 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
@@ -186,6 +186,26 @@ final class ChromeBluetoothDevice {
}
@Override
+ public void onCharacteristicChanged(
+ final Wrappers.BluetoothGattCharacteristicWrapper characteristic) {
+ Log.i(TAG, "device onCharacteristicChanged.");
+ ThreadUtils.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ ChromeBluetoothRemoteGattCharacteristic chromeCharacteristic =
+ mWrapperToChromeCharacteristicsMap.get(characteristic);
+ if (chromeCharacteristic == null) {
+ // Android events arriving with no Chrome object is expected rarely only
+ // when the event races object destruction.
+ Log.v(TAG, "onCharacteristicChanged when chromeCharacteristic == null.");
+ } else {
+ chromeCharacteristic.onCharacteristicChanged();
+ }
+ }
+ });
+ }
+
+ @Override
public void onCharacteristicRead(
final Wrappers.BluetoothGattCharacteristicWrapper characteristic,
final int status) {

Powered by Google App Engine
This is Rietveld 408576698