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

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

Issue 2707823002: bluetooth: Save characteristic value when notification arrives (Closed)
Patch Set: fix test Created 3 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/ChromeBluetoothRemoteGattCharacteristic.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/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 5ef691323b78b9b97b3d95102d4951adb5d92fab..1059c039324c7f8f0e17303ebf9f88393a532c36 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
@@ -196,6 +196,9 @@ final class ChromeBluetoothDevice {
public void onCharacteristicChanged(
final Wrappers.BluetoothGattCharacteristicWrapper characteristic) {
Log.i(TAG, "device onCharacteristicChanged.");
+ // Copy the characteristic's value for this event so that new notifications that
+ // arrive before the posted task runs do not affect this event's value.
+ final byte[] value = characteristic.getValue();
Wrappers.ThreadUtilsWrapper.getInstance().runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -206,7 +209,7 @@ final class ChromeBluetoothDevice {
// when the event races object destruction.
Log.v(TAG, "onCharacteristicChanged when chromeCharacteristic == null.");
} else {
- chromeCharacteristic.onCharacteristicChanged();
+ chromeCharacteristic.onCharacteristicChanged(value);
}
}
});
« no previous file with comments | « no previous file | device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698