Merge change Id8e98194 into eclair
* changes: Fix issues 2333450 and 2333559:
This commit is contained in:
@@ -282,7 +282,8 @@ public:
|
|||||||
FORCE_BT_SCO,
|
FORCE_BT_SCO,
|
||||||
FORCE_BT_A2DP,
|
FORCE_BT_A2DP,
|
||||||
FORCE_WIRED_ACCESSORY,
|
FORCE_WIRED_ACCESSORY,
|
||||||
FORCE_BT_DOCK,
|
FORCE_BT_CAR_DOCK,
|
||||||
|
FORCE_BT_DESK_DOCK,
|
||||||
NUM_FORCE_CONFIG,
|
NUM_FORCE_CONFIG,
|
||||||
FORCE_DEFAULT = FORCE_NONE
|
FORCE_DEFAULT = FORCE_NONE
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
private boolean mMediaServerOk;
|
private boolean mMediaServerOk;
|
||||||
|
|
||||||
/** cached value of the BT dock address to recognize undocking events */
|
/** cached value of the BT dock address to recognize undocking events */
|
||||||
private static String sBtDockAddress;
|
private static String sBtDockAddress = "";
|
||||||
|
|
||||||
private SoundPool mSoundPool;
|
private SoundPool mSoundPool;
|
||||||
private Object mSoundEffectsLock = new Object();
|
private Object mSoundEffectsLock = new Object();
|
||||||
@@ -231,6 +231,7 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
// Forced device usage for communications
|
// Forced device usage for communications
|
||||||
private int mForcedUseForComm;
|
private int mForcedUseForComm;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Construction
|
// Construction
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1414,9 +1415,25 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
(state == BluetoothA2dp.STATE_CONNECTED ||
|
(state == BluetoothA2dp.STATE_CONNECTED ||
|
||||||
state == BluetoothA2dp.STATE_PLAYING)) {
|
state == BluetoothA2dp.STATE_PLAYING)) {
|
||||||
if (btDevice.isBluetoothDock()) {
|
if (btDevice.isBluetoothDock()) {
|
||||||
Log.v(TAG, "Recognized docking to BT dock");
|
Log.v(TAG, "Recognized connection to BT dock");
|
||||||
sBtDockAddress = address;
|
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.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
|
||||||
AudioSystem.DEVICE_STATE_AVAILABLE,
|
AudioSystem.DEVICE_STATE_AVAILABLE,
|
||||||
|
|||||||
@@ -271,7 +271,8 @@ public class AudioSystem
|
|||||||
public static final int FORCE_BT_SCO = 3;
|
public static final int FORCE_BT_SCO = 3;
|
||||||
public static final int FORCE_BT_A2DP = 4;
|
public static final int FORCE_BT_A2DP = 4;
|
||||||
public static final int FORCE_WIRED_ACCESSORY = 5;
|
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;
|
public static final int FORCE_DEFAULT = FORCE_NONE;
|
||||||
|
|
||||||
// usage for serForceUse
|
// usage for serForceUse
|
||||||
|
|||||||
Reference in New Issue
Block a user