private boolean mMediaServerOk;
/** cached value of the BT dock address to recognize undocking events */
- private static String sBtDockAddress;
+ private static String sBtDockAddress = "";
private SoundPool mSoundPool;
private Object mSoundEffectsLock = new Object();
// Forced device usage for communications
private int mForcedUseForComm;
+
///////////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////////////////////////////////////////////////
(state == BluetoothA2dp.STATE_CONNECTED ||
state == BluetoothA2dp.STATE_PLAYING)) {
if (btDevice.isBluetoothDock()) {
- Log.v(TAG, "Recognized docking to BT dock");
+ Log.v(TAG, "Recognized connection to BT dock");
sBtDockAddress = address;
- AudioSystem.setForceUse(AudioSystem.FOR_DOCK, AudioSystem.FORCE_BT_DOCK);
+ Intent i = context.registerReceiver(null, new IntentFilter(Intent.ACTION_DOCK_EVENT));
+ if (i != null) {
+ int dockState = i.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED);
+ int config;
+ switch (dockState) {
+ case Intent.EXTRA_DOCK_STATE_DESK:
+ config = AudioSystem.FORCE_BT_DESK_DOCK;
+ break;
+ case Intent.EXTRA_DOCK_STATE_CAR:
+ config = AudioSystem.FORCE_BT_CAR_DOCK;
+ break;
+ case Intent.EXTRA_DOCK_STATE_UNDOCKED:
+ default:
+ config = AudioSystem.FORCE_NONE;
+ }
+ AudioSystem.setForceUse(AudioSystem.FOR_DOCK, config);
+ }
}
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
AudioSystem.DEVICE_STATE_AVAILABLE,
public static final int FORCE_BT_SCO = 3;
public static final int FORCE_BT_A2DP = 4;
public static final int FORCE_WIRED_ACCESSORY = 5;
- public static final int FORCE_BT_DOCK = 6;
+ public static final int FORCE_BT_CAR_DOCK = 6;
+ public static final int FORCE_BT_DESK_DOCK = 7;
public static final int FORCE_DEFAULT = FORCE_NONE;
// usage for serForceUse