am e3f7c452
: Merge "Settings shows it is connected to A2DP, though the device is not actually connected" into jb-mr1.1-dev
* commit 'e3f7c45241a90d3e4b76d28911831f5dcbaaa038': Settings shows it is connected to A2DP, though the device is not actually connected
This commit is contained in:
@ -775,8 +775,18 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
|
|
||||||
// Send BT state broadcast to update
|
// Send BT state broadcast to update
|
||||||
// the BT icon correctly
|
// the BT icon correctly
|
||||||
|
if ((mState == BluetoothAdapter.STATE_TURNING_ON) ||
|
||||||
|
(mState == BluetoothAdapter.STATE_ON)) {
|
||||||
bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
|
bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
|
||||||
BluetoothAdapter.STATE_TURNING_OFF);
|
BluetoothAdapter.STATE_TURNING_OFF);
|
||||||
|
mState = BluetoothAdapter.STATE_TURNING_OFF;
|
||||||
|
}
|
||||||
|
if (mState == BluetoothAdapter.STATE_TURNING_OFF) {
|
||||||
|
bluetoothStateChangeHandler(BluetoothAdapter.STATE_TURNING_OFF,
|
||||||
|
BluetoothAdapter.STATE_OFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
|
||||||
mState = BluetoothAdapter.STATE_OFF;
|
mState = BluetoothAdapter.STATE_OFF;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -820,20 +830,33 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
|
|
||||||
|
if (mState == BluetoothAdapter.STATE_TURNING_OFF) {
|
||||||
|
// MESSAGE_USER_SWITCHED happened right after MESSAGE_ENABLE
|
||||||
|
bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_OFF);
|
||||||
|
mState = BluetoothAdapter.STATE_OFF;
|
||||||
|
}
|
||||||
|
if (mState == BluetoothAdapter.STATE_OFF) {
|
||||||
|
bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_TURNING_ON);
|
||||||
|
mState = BluetoothAdapter.STATE_TURNING_ON;
|
||||||
|
}
|
||||||
|
|
||||||
waitForOnOff(true, false);
|
waitForOnOff(true, false);
|
||||||
|
|
||||||
|
if (mState == BluetoothAdapter.STATE_TURNING_ON) {
|
||||||
bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_ON);
|
bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_ON);
|
||||||
|
}
|
||||||
|
|
||||||
// disable
|
// disable
|
||||||
handleDisable(false);
|
handleDisable(false);
|
||||||
|
// Pbap service need receive STATE_TURNING_OFF intent to close
|
||||||
|
bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
|
||||||
|
BluetoothAdapter.STATE_TURNING_OFF);
|
||||||
|
|
||||||
waitForOnOff(false, true);
|
waitForOnOff(false, true);
|
||||||
|
|
||||||
bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
|
bluetoothStateChangeHandler(BluetoothAdapter.STATE_TURNING_OFF,
|
||||||
BluetoothAdapter.STATE_OFF);
|
BluetoothAdapter.STATE_OFF);
|
||||||
mState = BluetoothAdapter.STATE_OFF;
|
|
||||||
sendBluetoothServiceDownCallback();
|
sendBluetoothServiceDownCallback();
|
||||||
synchronized (mConnection) {
|
synchronized (mConnection) {
|
||||||
if (mBluetooth != null) {
|
if (mBluetooth != null) {
|
||||||
@ -844,6 +867,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
}
|
}
|
||||||
SystemClock.sleep(100);
|
SystemClock.sleep(100);
|
||||||
|
|
||||||
|
mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
|
||||||
|
mState = BluetoothAdapter.STATE_OFF;
|
||||||
// enable
|
// enable
|
||||||
handleEnable(false, mQuietEnable);
|
handleEnable(false, mQuietEnable);
|
||||||
} else if (mBinding || mBluetooth != null) {
|
} else if (mBinding || mBluetooth != null) {
|
||||||
|
Reference in New Issue
Block a user