summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Johanna Ye <xincheny@google.com> 2021-06-29 16:19:53 +0200
committer Johanna Ye <xincheny@google.com> 2021-06-29 16:19:53 +0200
commite36f798dea54cdbccaf907ada652dfd981356ae2 (patch)
treeae560ea519420271b206043542e7c9b62ed46583
parentf334f4ed310b21bae89a166fe06aac5657cfb79e (diff)
Add synchronization to all mDeviceBusy state changes.
Tag: #stability Test: make Bug: 169559728 Change-Id: I5c1b926a4c774b4bc5f24a9aaa66aa5f7780e121
-rw-r--r--core/java/android/bluetooth/BluetoothGatt.java24
1 files changed, 18 insertions, 6 deletions
diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java
index 381318b26dad..1d08ddb65cf4 100644
--- a/core/java/android/bluetooth/BluetoothGatt.java
+++ b/core/java/android/bluetooth/BluetoothGatt.java
@@ -1153,7 +1153,9 @@ public final class BluetoothGatt implements BluetoothProfile {
characteristic.getInstanceId(), AUTHENTICATION_NONE);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- mDeviceBusy = false;
+ synchronized (mDeviceBusyLock) {
+ mDeviceBusy = false;
+ }
return false;
}
@@ -1187,7 +1189,9 @@ public final class BluetoothGatt implements BluetoothProfile {
new ParcelUuid(uuid), startHandle, endHandle, AUTHENTICATION_NONE);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- mDeviceBusy = false;
+ synchronized (mDeviceBusyLock) {
+ mDeviceBusy = false;
+ }
return false;
}
@@ -1234,7 +1238,9 @@ public final class BluetoothGatt implements BluetoothProfile {
AUTHENTICATION_NONE, characteristic.getValue());
} catch (RemoteException e) {
Log.e(TAG, "", e);
- mDeviceBusy = false;
+ synchronized (mDeviceBusyLock) {
+ mDeviceBusy = false;
+ }
return false;
}
@@ -1276,7 +1282,9 @@ public final class BluetoothGatt implements BluetoothProfile {
descriptor.getInstanceId(), AUTHENTICATION_NONE);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- mDeviceBusy = false;
+ synchronized (mDeviceBusyLock) {
+ mDeviceBusy = false;
+ }
return false;
}
@@ -1317,7 +1325,9 @@ public final class BluetoothGatt implements BluetoothProfile {
AUTHENTICATION_NONE, descriptor.getValue());
} catch (RemoteException e) {
Log.e(TAG, "", e);
- mDeviceBusy = false;
+ synchronized (mDeviceBusyLock) {
+ mDeviceBusy = false;
+ }
return false;
}
@@ -1384,7 +1394,9 @@ public final class BluetoothGatt implements BluetoothProfile {
mService.endReliableWrite(mClientIf, mDevice.getAddress(), true);
} catch (RemoteException e) {
Log.e(TAG, "", e);
- mDeviceBusy = false;
+ synchronized (mDeviceBusyLock) {
+ mDeviceBusy = false;
+ }
return false;
}