diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-10-18 22:00:49 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-10-18 22:00:49 +0000 |
commit | 34f9a3e9e93f9f27ebd549db2a39d5d696faa5bf (patch) | |
tree | 19976a464ec60a1d75097a1e2944ff52a5b9d578 | |
parent | 0c9254ee667ca97d3128da18158c003de10b35c5 (diff) | |
parent | 6c96b70195c492c2febb96fef37e3d72fbedeaf9 (diff) | |
download | base-34f9a3e9e93f9f27ebd549db2a39d5d696faa5bf.tar.gz |
Merge "Synchronize on a static final object to lock mDeviceBusy"
-rw-r--r-- | core/java/android/bluetooth/BluetoothGatt.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java index 78248efdd048..d8a7834eb757 100644 --- a/core/java/android/bluetooth/BluetoothGatt.java +++ b/core/java/android/bluetooth/BluetoothGatt.java @@ -56,6 +56,7 @@ public final class BluetoothGatt implements BluetoothProfile { private int mAuthRetryState; private int mConnState; private final Object mStateLock = new Object(); + private final Object mDeviceBusyLock = new Object(); @UnsupportedAppUsage private Boolean mDeviceBusy = false; @UnsupportedAppUsage @@ -281,7 +282,7 @@ public final class BluetoothGatt implements BluetoothProfile { } } - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { mDeviceBusy = false; } } @@ -356,7 +357,7 @@ public final class BluetoothGatt implements BluetoothProfile { return; } - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { mDeviceBusy = false; } @@ -412,7 +413,7 @@ public final class BluetoothGatt implements BluetoothProfile { return; } - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { mDeviceBusy = false; } @@ -495,7 +496,7 @@ public final class BluetoothGatt implements BluetoothProfile { return; } - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { mDeviceBusy = false; } @@ -546,7 +547,7 @@ public final class BluetoothGatt implements BluetoothProfile { return; } - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { mDeviceBusy = false; } @@ -595,7 +596,7 @@ public final class BluetoothGatt implements BluetoothProfile { return; } - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { mDeviceBusy = false; } @@ -1097,7 +1098,7 @@ public final class BluetoothGatt implements BluetoothProfile { BluetoothDevice device = service.getDevice(); if (device == null) return false; - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { if (mDeviceBusy) return false; mDeviceBusy = true; } @@ -1131,7 +1132,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (VDBG) Log.d(TAG, "readUsingCharacteristicUuid() - uuid: " + uuid); if (mService == null || mClientIf == 0) return false; - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { if (mDeviceBusy) return false; mDeviceBusy = true; } @@ -1177,7 +1178,7 @@ public final class BluetoothGatt implements BluetoothProfile { BluetoothDevice device = service.getDevice(); if (device == null) return false; - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { if (mDeviceBusy) return false; mDeviceBusy = true; } @@ -1220,7 +1221,7 @@ public final class BluetoothGatt implements BluetoothProfile { BluetoothDevice device = service.getDevice(); if (device == null) return false; - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { if (mDeviceBusy) return false; mDeviceBusy = true; } @@ -1261,7 +1262,7 @@ public final class BluetoothGatt implements BluetoothProfile { BluetoothDevice device = service.getDevice(); if (device == null) return false; - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { if (mDeviceBusy) return false; mDeviceBusy = true; } @@ -1329,7 +1330,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (VDBG) Log.d(TAG, "executeReliableWrite() - device: " + mDevice.getAddress()); if (mService == null || mClientIf == 0) return false; - synchronized (mDeviceBusy) { + synchronized (mDeviceBusyLock) { if (mDeviceBusy) return false; mDeviceBusy = true; } |