diff options
author | Jason Monk <jmonk@google.com> | 2015-08-12 16:17:34 -0400 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2015-08-12 16:17:34 -0400 |
commit | bba7317d0764f40ef365d4152c68e7dd3bacc580 (patch) | |
tree | f8e4d40d0ebc0371f0fc237267a9df11a56491e2 | |
parent | bf88205bef88f78ade5c6830e6203aa343387820 (diff) | |
download | frameworks_base-bba7317d0764f40ef365d4152c68e7dd3bacc580.zip frameworks_base-bba7317d0764f40ef365d4152c68e7dd3bacc580.tar.gz frameworks_base-bba7317d0764f40ef365d4152c68e7dd3bacc580.tar.bz2 |
Add more intelligence to bluetooth connection state
Since bluetooth connection state has a mind of its own... If we
think we are connected, but we don't actually know about any devices
that are currently connected, we probably aren't. So set the state
that way, and let everyone know.
Bug: 22977827
Change-Id: I9266f5394b179a3917b3818839f7c6b2dc238376
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java index daa84ad..a04edf7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java @@ -164,11 +164,18 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa // Our current device is still valid. return; } + mLastDevice = null; for (CachedBluetoothDevice device : getDevices()) { if (device.isConnected()) { mLastDevice = device; } } + if (mLastDevice == null && mConnectionState == BluetoothAdapter.STATE_CONNECTED) { + // If somehow we think we are connected, but have no connected devices, we aren't + // connected. + mConnectionState = BluetoothAdapter.STATE_DISCONNECTED; + mHandler.sendEmptyMessage(H.MSG_STATE_CHANGED); + } } @Override |