summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@google.com>2012-09-18 11:16:57 -0700
committerMike Lockwood <lockwood@google.com>2012-09-18 14:55:52 -0700
commitdb45484e4b5858d14da93d3a06311b93bf0cf320 (patch)
tree9378bbc1cb49ede20829749ac88fb6b697009499 /media
parent5dbeb6a8ff8ae30f59ba8335c2354b883302428e (diff)
downloadframeworks_base-db45484e4b5858d14da93d3a06311b93bf0cf320.zip
frameworks_base-db45484e4b5858d14da93d3a06311b93bf0cf320.tar.gz
frameworks_base-db45484e4b5858d14da93d3a06311b93bf0cf320.tar.bz2
AudioService: Send "becoming noisy" intent when USB accessory audio is disconnected
Bug: 7051259 Change-Id: I5b5fb3ad7c7e38dbf49700d893fd49354eaecf51 Signed-off-by: Mike Lockwood <lockwood@google.com>
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioService.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 4459d03..3a398a1 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -3490,12 +3490,15 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
(device == AudioSystem.DEVICE_OUT_WIRED_HEADPHONE))) {
setBluetoothA2dpOnInt(true);
}
- handleDeviceConnection((state == 1), device, "");
+ boolean isUsb = ((device & AudioSystem.DEVICE_OUT_ALL_USB) != 0);
+ handleDeviceConnection((state == 1), device, (isUsb ? name : ""));
if ((state != 0) && ((device == AudioSystem.DEVICE_OUT_WIRED_HEADSET) ||
(device == AudioSystem.DEVICE_OUT_WIRED_HEADPHONE))) {
setBluetoothA2dpOnInt(false);
}
- sendDeviceConnectionIntent(device, state, name);
+ if (!isUsb) {
+ sendDeviceConnectionIntent(device, state, name);
+ }
}
}
@@ -3587,7 +3590,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
+ (action.equals(Intent.ACTION_USB_AUDIO_ACCESSORY_PLUG) ?
"ACTION_USB_AUDIO_ACCESSORY_PLUG" : "ACTION_USB_AUDIO_DEVICE_PLUG")
+ ", state = " + state + ", card: " + alsaCard + ", device: " + alsaDevice);
- handleDeviceConnection((state == 1), device, params);
+ setWiredDeviceConnectionState(device, state, params);
} else if (action.equals(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED)) {
boolean broadcast = false;
int scoAudioState = AudioManager.SCO_AUDIO_STATE_ERROR;