diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2010-04-23 11:49:29 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2010-04-23 13:59:45 -0700 |
commit | a847ba4080675d395de725cfac5dfd9d5a993d4e (patch) | |
tree | 813754d2bc67bf38cee5ae366bcb433fe5670726 /media/java | |
parent | 7b88af679a9a3b5737343bb996ef392b76d19e73 (diff) | |
download | frameworks_base-a847ba4080675d395de725cfac5dfd9d5a993d4e.zip frameworks_base-a847ba4080675d395de725cfac5dfd9d5a993d4e.tar.gz frameworks_base-a847ba4080675d395de725cfac5dfd9d5a993d4e.tar.bz2 |
Fix bug 2619062 Music is routed to Phone speaker, though it is
connected to A2DP media profile
When the phone is docked and using the dock A2DP, and the user
connects another A2DP device, make the dock unavailable immediately
before connecting the new A2DP device.
Change-Id: I82d53836fb509ee4ea7cdb68f467dfb946c634f8
Diffstat (limited to 'media/java')
-rw-r--r-- | media/java/android/media/AudioService.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 97b96bc..d55d0a5 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -1751,10 +1751,17 @@ public class AudioService extends IAudioService.Stub { } - private void cancelA2dpDeviceTimeout(String address) { + private void cancelA2dpDeviceTimeout() { mAudioHandler.removeMessages(MSG_BTA2DP_DOCK_TIMEOUT); } + private boolean hasScheduledA2dpDockTimeout() { + return mAudioHandler.hasMessages(MSG_BTA2DP_DOCK_TIMEOUT); + } + + /* cache of the address of the last dock the device was connected to */ + private String mDockAddress; + /** * Receiver for misc intent broadcasts the Phone app cares about. */ @@ -1805,7 +1812,15 @@ public class AudioService extends IAudioService.Stub { state == BluetoothA2dp.STATE_PLAYING)) { if (btDevice.isBluetoothDock()) { // this could be a reconnection after a transient disconnection - cancelA2dpDeviceTimeout(address); + cancelA2dpDeviceTimeout(); + mDockAddress = address; + } else { + // this could be a connection of another A2DP device before the timeout of + // a dock: cancel the dock timeout, and make the dock unavailable now + if(hasScheduledA2dpDockTimeout()) { + cancelA2dpDeviceTimeout(); + makeA2dpDeviceUnavailableNow(mDockAddress); + } } makeA2dpDeviceAvailable(address); } |