OSDN Git Service

bluetooth won't turn on after turn Airplane mode off on setting screen on manta(tablet)
authorZhihai Xu <zhihaixu@google.com>
Wed, 17 Oct 2012 19:35:14 +0000 (12:35 -0700)
committerZhihai Xu <zhihaixu@google.com>
Wed, 17 Oct 2012 20:57:43 +0000 (13:57 -0700)
commit0b21b3d725935c03a4ca4ab8476da2b0675a53cd
tree4183afbc01a839d1b39c8a5c89411622253f3978
parent891185a4fa836c1d386eda0667cf34e293380b48
bluetooth won't turn on after turn Airplane mode off on setting screen on manta(tablet)

The root cause is normally when change the airplane mode, the bluetooth setting UI
 will not be foreground. No listener is setup for bluetooth setting UI when it is
 in background. So the onCheckedChanged won't be called and mLocalAdapter.setBluetoothEnabled
 won't be called. But for manta, airplane mode setting and bluetooth setting UI both
 will show on the foreground due to bigger screen size. When we turn ariplane mode on,
 bluetooth manager service will disable bluetooth without changing the persist bluetooth setting.
 But bluetooth setting UI will listen to the bluetooth state change intent, it will receive
 bluetooth state turn-off intent then it will call mSwitch.setChecked(false) in handleStateChanged,
 which cause checked status changed from true to false to trigger the listener (onCheckedChanged)
 being called. The listener will call mAdapter.disable() which will call mManagerService.disable(true)
 to change bluetooth persist state to OFF. So when we turn back airplane more to OFF,
 due to the bluetooth persist state is OFF, we won't turn back bluetooth to ON.

bug 7366814
Change-Id: I07d4a2dfe03fc6775cfeabb28cd3a0cc1fded44e
src/com/android/settings/bluetooth/BluetoothEnabler.java