diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2009-12-09 11:50:36 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-12-09 11:50:36 -0800 |
commit | ed3e7ab3bf15bc1eefaade7e1f641d02d04c80c2 (patch) | |
tree | 03922b440932030ff2536ef267b585b2eba66c3b /media | |
parent | ea8649c61d655149d4f95e53c4c8b717e91d728d (diff) | |
parent | 86ed86d2260932bdf2217b1d8431ac9e04d47534 (diff) | |
download | frameworks_base-ed3e7ab3bf15bc1eefaade7e1f641d02d04c80c2.zip frameworks_base-ed3e7ab3bf15bc1eefaade7e1f641d02d04c80c2.tar.gz frameworks_base-ed3e7ab3bf15bc1eefaade7e1f641d02d04c80c2.tar.bz2 |
am 86ed86d2: Merge change I0f73439a into eclair
Merge commit '86ed86d2260932bdf2217b1d8431ac9e04d47534' into eclair-plus-aosp
* commit '86ed86d2260932bdf2217b1d8431ac9e04d47534':
Partially fix bug 2111240 Detect docking / undocking event by reporting
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioService.java | 12 | ||||
-rw-r--r-- | media/java/android/media/AudioSystem.java | 2 |
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); |