Merge "Bluetooth: fix GATT race conditions when using Handler" am: 06b29a87d7
am: 9054e03cf4
Change-Id: Ib31912b6f39b5cc3ef9623e9daeddfcd3d732fbe
This commit is contained in:
@@ -371,12 +371,11 @@ public final class BluetoothGatt implements BluetoothProfile {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == 0) characteristic.setValue(value);
|
|
||||||
|
|
||||||
runOrQueueCallback(new Runnable() {
|
runOrQueueCallback(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
|
if (status == 0) characteristic.setValue(value);
|
||||||
mCallback.onCharacteristicRead(BluetoothGatt.this, characteristic,
|
mCallback.onCharacteristicRead(BluetoothGatt.this, characteristic,
|
||||||
status);
|
status);
|
||||||
}
|
}
|
||||||
@@ -454,12 +453,11 @@ public final class BluetoothGatt implements BluetoothProfile {
|
|||||||
handle);
|
handle);
|
||||||
if (characteristic == null) return;
|
if (characteristic == null) return;
|
||||||
|
|
||||||
characteristic.setValue(value);
|
|
||||||
|
|
||||||
runOrQueueCallback(new Runnable() {
|
runOrQueueCallback(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
|
characteristic.setValue(value);
|
||||||
mCallback.onCharacteristicChanged(BluetoothGatt.this,
|
mCallback.onCharacteristicChanged(BluetoothGatt.this,
|
||||||
characteristic);
|
characteristic);
|
||||||
}
|
}
|
||||||
@@ -489,7 +487,6 @@ public final class BluetoothGatt implements BluetoothProfile {
|
|||||||
BluetoothGattDescriptor descriptor = getDescriptorById(mDevice, handle);
|
BluetoothGattDescriptor descriptor = getDescriptorById(mDevice, handle);
|
||||||
if (descriptor == null) return;
|
if (descriptor == null) return;
|
||||||
|
|
||||||
if (status == 0) descriptor.setValue(value);
|
|
||||||
|
|
||||||
if ((status == GATT_INSUFFICIENT_AUTHENTICATION
|
if ((status == GATT_INSUFFICIENT_AUTHENTICATION
|
||||||
|| status == GATT_INSUFFICIENT_ENCRYPTION)
|
|| status == GATT_INSUFFICIENT_ENCRYPTION)
|
||||||
@@ -511,6 +508,7 @@ public final class BluetoothGatt implements BluetoothProfile {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
|
if (status == 0) descriptor.setValue(value);
|
||||||
mCallback.onDescriptorRead(BluetoothGatt.this, descriptor, status);
|
mCallback.onDescriptorRead(BluetoothGatt.this, descriptor, status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user