diff options
author | Andre Eisenbach <eisenbach@google.com> | 2016-05-19 21:59:25 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-05-19 21:59:25 +0000 |
commit | 53ccfe848f1b97cca12c7e5b496032e97594a8e2 (patch) | |
tree | 62eda2c89b8dca03065a1d7a0e7467f8db9f141d | |
parent | 4bc3d32b15cdcae7685722e7a20007c7aa9ae949 (diff) | |
parent | 636ab03dfeb46baa1a7a15ded0e40174a868f765 (diff) | |
download | base-53ccfe848f1b97cca12c7e5b496032e97594a8e2.tar.gz |
Merge "Fix GATT autoConnect race condition"
-rw-r--r-- | core/java/android/bluetooth/BluetoothGatt.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java index b8a40dc6895a..800dd434a969 100644 --- a/core/java/android/bluetooth/BluetoothGatt.java +++ b/core/java/android/bluetooth/BluetoothGatt.java @@ -645,6 +645,9 @@ public final class BluetoothGatt implements BluetoothProfile { } mConnState = CONN_STATE_CONNECTING; } + + mAutoConnect = autoConnect; + if (!registerApp(callback)) { synchronized(mStateLock) { mConnState = CONN_STATE_IDLE; @@ -653,8 +656,7 @@ public final class BluetoothGatt implements BluetoothProfile { return false; } - // the connection will continue after successful callback registration - mAutoConnect = autoConnect; + // The connection will continue in the onClientRegistered callback return true; } |