b/2367861 Auto connect if the user turns on BT while docked.

Change-Id: I855d0448af9c9c665fb8288c83cd13ae9c3d6050
This commit is contained in:
Michael Chan
2010-01-13 16:31:39 -08:00
parent c5aa68f3f2
commit 845e740fc6
4 changed files with 80 additions and 20 deletions

View File

@@ -27,7 +27,7 @@ import android.util.Log;
public class DockEventReceiver extends BroadcastReceiver {
private static final boolean DEBUG = false;
private static final boolean DEBUG = DockService.DEBUG;
private static final String TAG = "DockEventReceiver";
@@ -74,6 +74,13 @@ public class DockEventReceiver extends BroadcastReceiver {
if (DEBUG) Log.e(TAG, "Unknown state");
break;
}
} else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(intent.getAction())) {
int btState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
if (btState == BluetoothAdapter.STATE_ON) {
Intent i = new Intent(intent);
i.setClass(context, DockService.class);
beginStartingService(context, i);
}
}
}