diff options
author | Jungshik Jang <jayjang@google.com> | 2014-07-03 00:43:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-02 20:35:42 +0000 |
commit | 3c643073650f469574498c68a6c30e5098350c33 (patch) | |
tree | afc2c5ca1a13216ef8de6efd54467365394fff96 /services/audiopolicy | |
parent | 6a3eb6a1b1bf59ebc8c7aba8a0a3542d60d2fcfa (diff) | |
parent | 839e4f33906b650140b578d42d6a51300f26703c (diff) | |
download | frameworks_av-3c643073650f469574498c68a6c30e5098350c33.zip frameworks_av-3c643073650f469574498c68a6c30e5098350c33.tar.gz frameworks_av-3c643073650f469574498c68a6c30e5098350c33.tar.bz2 |
Merge "Add force usage and category for System Audio Control."
Diffstat (limited to 'services/audiopolicy')
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index 4fcf43b..95179b7 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -516,7 +516,10 @@ 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_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) { ALOGW("setForceUse() invalid config %d for FOR_MEDIA", config); return; } @@ -3536,10 +3539,32 @@ audio_devices_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strate if (device2 == AUDIO_DEVICE_NONE) { device2 = availableOutputDeviceTypes & AUDIO_DEVICE_OUT_SPEAKER; } + 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; + } + } + // 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) { |