summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2009-12-07 18:40:56 -0800
committerJean-Michel Trivi <jmtrivi@google.com>2009-12-07 20:42:52 -0800
commit6154412ee8e07e9cde129cccb944dd7ed9dcef53 (patch)
treebb568c3907b2da5ae9098457ec19ec80762b8036 /media
parent6d42d80653f2c41f3e72a878a1d9a6f9693b89f7 (diff)
downloadframeworks_base-6154412ee8e07e9cde129cccb944dd7ed9dcef53.zip
frameworks_base-6154412ee8e07e9cde129cccb944dd7ed9dcef53.tar.gz
frameworks_base-6154412ee8e07e9cde129cccb944dd7ed9dcef53.tar.bz2
Partially fix bug 2111240 Detect docking / undocking event by reporting
to the AudioPolicyManager a new forced usage AudioSystem::FOR_DOCK which can take the FORCE_NONE, FORCE_BT_DOCK or FORCE_WIRED_ACCESSORY values. This CL is complemented by an update of the APM to take into account the FOR_DOCK usage.
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioService.java12
-rw-r--r--media/java/android/media/AudioSystem.java2
2 files changed, 14 insertions, 0 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 3b40612..b41f3e2 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -111,6 +111,9 @@ public class AudioService extends IAudioService.Stub {
private Object mSettingsLock = new Object();
private boolean mMediaServerOk;
+ /** cached value of the BT dock address to recognize undocking events */
+ private static String sBtDockAddress;
+
private SoundPool mSoundPool;
private Object mSoundEffectsLock = new Object();
private static final int NUM_SOUNDPOOL_CHANNELS = 4;
@@ -1399,6 +1402,10 @@ public class AudioService extends IAudioService.Stub {
if (isConnected &&
state != BluetoothA2dp.STATE_CONNECTED && state != BluetoothA2dp.STATE_PLAYING) {
+ if (address.equals(sBtDockAddress)) {
+ Log.v(TAG, "Recognized undocking from BT dock");
+ AudioSystem.setForceUse(AudioSystem.FOR_DOCK, AudioSystem.FORCE_NONE);
+ }
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
AudioSystem.DEVICE_STATE_UNAVAILABLE,
address);
@@ -1406,6 +1413,11 @@ public class AudioService extends IAudioService.Stub {
} else if (!isConnected &&
(state == BluetoothA2dp.STATE_CONNECTED ||
state == BluetoothA2dp.STATE_PLAYING)) {
+ if (btDevice.isBluetoothDock()) {
+ Log.v(TAG, "Recognized docking to BT dock");
+ sBtDockAddress = address;
+ AudioSystem.setForceUse(AudioSystem.FOR_DOCK, AudioSystem.FORCE_BT_DOCK);
+ }
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
AudioSystem.DEVICE_STATE_AVAILABLE,
address);
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 9fe5328..9e9b259 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -271,12 +271,14 @@ public class AudioSystem
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_DEFAULT = FORCE_NONE;
// usage for serForceUse
public static final int FOR_COMMUNICATION = 0;
public static final int FOR_MEDIA = 1;
public static final int FOR_RECORD = 2;
+ public static final int FOR_DOCK = 3;
public static native int setDeviceConnectionState(int device, int state, String device_address);
public static native int getDeviceConnectionState(int device, String device_address);