b/2332395 Disable BT when undocked if BT was off to at docking time

unless if 1) the user has manually turned off bt while docked or
2) there's a connect device at the time we are ready to turn off bt

Change-Id: Ic27308688a525120a09a25c9416b3cdc477412ab
This commit is contained in:
Michael Chan
2010-01-14 17:52:40 -08:00
parent 6ff80dcf7a
commit 3fe86a346c
2 changed files with 132 additions and 18 deletions

View File

@@ -47,7 +47,8 @@ public class DockEventReceiver extends BroadcastReceiver {
if (intent == null)
return;
int state = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, EXTRA_INVALID);
int state = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, intent.getIntExtra(
BluetoothAdapter.EXTRA_STATE, EXTRA_INVALID));
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (DEBUG) {
@@ -76,7 +77,7 @@ public class DockEventReceiver extends BroadcastReceiver {
}
} else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(intent.getAction())) {
int btState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
if (btState == BluetoothAdapter.STATE_ON) {
if (btState != BluetoothAdapter.STATE_TURNING_ON) {
Intent i = new Intent(intent);
i.setClass(context, DockService.class);
beginStartingService(context, i);