Skip to content

Commit 7f58b36

Browse files
author
Matthew Xie
committed
Always move Bluetooth Adapter to cold state when turn off Bluetooth.
quick switch feature introduced in ICS does not work very well. Reported logs indicate the Bluez stack cannot sustain the long time ON/hotoff state. This change will always move the adapter to code but move it to hotoff to be able to turn on quickly. bug 5792792 Change-Id: I41c39d4bf11bb5eb3cd83279e8ec81e01774e008
1 parent d72ad2a commit 7f58b36

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

core/java/android/server/BluetoothAdapterStateMachine.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,10 @@ public boolean processMessage(Message message) {
441441
if (mPublicState == BluetoothAdapter.STATE_TURNING_OFF) {
442442
transitionTo(mHotOff);
443443
finishSwitchingOff();
444-
if (!mContext.getResources().getBoolean
445-
(com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) {
446-
deferMessage(obtainMessage(TURN_COLD));
444+
deferMessage(obtainMessage(TURN_COLD));
445+
if (mContext.getResources().getBoolean
446+
(com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) {
447+
deferMessage(obtainMessage(TURN_HOT));
447448
}
448449
}
449450
} else {
@@ -612,9 +613,10 @@ public boolean processMessage(Message message) {
612613
removeMessages(POWER_DOWN_TIMEOUT);
613614
if (!((Boolean) message.obj)) {
614615
transitionTo(mHotOff);
615-
if (!mContext.getResources().getBoolean
616+
deferMessage(obtainMessage(TURN_COLD));
617+
if (mContext.getResources().getBoolean
616618
(com.android.internal.R.bool.config_bluetooth_adapter_quick_switch)) {
617-
deferMessage(obtainMessage(TURN_COLD));
619+
deferMessage(obtainMessage(TURN_HOT));
618620
}
619621
} else {
620622
if (!isTurningOn) {

0 commit comments

Comments
 (0)