summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy
diff options
context:
space:
mode:
authorJungshik Jang <jayjang@google.com>2014-07-08 22:11:24 +0900
committerJungshik Jang <jayjang@google.com>2014-07-10 11:31:51 +0900
commit0c94309d3c6db555b57f2e2e2dc3a0a2676ac6b7 (patch)
tree5695b499e9f5f9da2e37b6daf245758054b4e5e3 /services/audiopolicy
parent01cab9ce4fb203fab8f5115ff866f9f0cc96a73a (diff)
downloadframeworks_av-0c94309d3c6db555b57f2e2e2dc3a0a2676ac6b7.zip
frameworks_av-0c94309d3c6db555b57f2e2e2dc3a0a2676ac6b7.tar.gz
frameworks_av-0c94309d3c6db555b57f2e2e2dc3a0a2676ac6b7.tar.bz2
Revamp HDMI-CEC system audio mode integration with audio service.
In previous change we use setForceUse(FORCE_MEDIA, XXX) method in order to set specific audio output type, such as LINE, HDMI_ARC, and SPDIF. But it turns out that it conflicts with bluetooth a2dp which uses the same setForceUse(FORCE_MEDIA, yyy). This change is based on several conditions. 1. When other non-speaker devices are on, prevent system audio from turing on. 2. In order to keep track of other devices' connectivity and to turn off system audio if other device like bluetooth or headphone preempts current output, register OnAudioPortChangeListner to audio manager. 3. All possible system audio outputs can be merged with other outputs without priority. Change-Id: Ic5ccc80f9b48fb77433c347de7969837c69e58c1
Diffstat (limited to 'services/audiopolicy')
-rw-r--r--services/audiopolicy/AudioPolicyManager.cpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp
index bb3bce8..73c9313 100644
--- a/services/audiopolicy/AudioPolicyManager.cpp
+++ b/services/audiopolicy/AudioPolicyManager.cpp
@@ -517,10 +517,7 @@ void AudioPolicyManager::setForceUse(audio_policy_force_use_t usage,
config != AUDIO_POLICY_FORCE_WIRED_ACCESSORY &&
config != AUDIO_POLICY_FORCE_ANALOG_DOCK &&
config != AUDIO_POLICY_FORCE_DIGITAL_DOCK && config != AUDIO_POLICY_FORCE_NONE &&
- config != AUDIO_POLICY_FORCE_NO_BT_A2DP &&
- config != AUDIO_POLICY_FORCE_SYSTEM_AUDIO_HDMI_ARC &&
- config != AUDIO_POLICY_FORCE_SYSTEM_AUDIO_SPDIF &&
- config != AUDIO_POLICY_FORCE_SYSTEM_AUDIO_LINE) {
+ config != AUDIO_POLICY_FORCE_NO_BT_A2DP) {
ALOGW("setForceUse() invalid config %d for FOR_MEDIA", config);
return;
}
@@ -3542,30 +3539,17 @@ audio_devices_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strate
}
int device3 = AUDIO_DEVICE_NONE;
if (strategy == STRATEGY_MEDIA) {
- // Hdmi system audio should use manually configured device type.
- if (mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA]
- == AUDIO_POLICY_FORCE_SYSTEM_AUDIO_HDMI_ARC) {
- device3 = availableOutputDeviceTypes & AUDIO_DEVICE_OUT_HDMI_ARC;
- } else if (mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA]
- == AUDIO_POLICY_FORCE_SYSTEM_AUDIO_SPDIF) {
- device3 = availableOutputDeviceTypes & AUDIO_DEVICE_OUT_SPDIF;
- } else if (mForceUse[AUDIO_POLICY_FORCE_FOR_MEDIA]
- == AUDIO_POLICY_FORCE_SYSTEM_AUDIO_LINE) {
- device3 = availableOutputDeviceTypes & AUDIO_DEVICE_OUT_LINE;
- }
+ // ARC, SPDIF and LINE can co-exist with others.
+ device3 = availableOutputDeviceTypes & AUDIO_DEVICE_OUT_HDMI_ARC;
+ device3 |= (availableOutputDeviceTypes & AUDIO_DEVICE_OUT_SPDIF);
+ device3 |= (availableOutputDeviceTypes & AUDIO_DEVICE_OUT_LINE);
}
- // Merge hdmi cec system audio and existing device for media. If system audio is on,
- // internal speaker will be muted but others are not.
device2 |= device3;
// device is DEVICE_OUT_SPEAKER if we come from case STRATEGY_SONIFICATION or
// STRATEGY_ENFORCED_AUDIBLE, AUDIO_DEVICE_NONE otherwise
device |= device2;
- // If system audio mode is on and proper audio out is set, remove speaker from device.
- if (device3 != AUDIO_DEVICE_NONE) {
- device &= ~AUDIO_DEVICE_OUT_SPEAKER;
- }
if (device) break;
device = mDefaultOutputDevice->mDeviceType;
if (device == AUDIO_DEVICE_NONE) {