diff options
Diffstat (limited to 'services/audiopolicy')
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index 1b4796b..f2320de 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -560,6 +560,13 @@ void AudioPolicyManager::setForceUse(audio_policy_force_use_t usage, forceVolumeReeval = true; mForceUse[usage] = config; break; + case AUDIO_POLICY_FORCE_FOR_HDMI_SYSTEM_AUDIO: + if (config != AUDIO_POLICY_FORCE_NONE && + config != AUDIO_POLICY_FORCE_HDMI_SYSTEM_AUDIO_ENFORCED) { + ALOGW("setForceUse() invalid config %d forHDMI_SYSTEM_AUDIO", config); + } + mForceUse[usage] = config; + break; default: ALOGW("setForceUse() invalid usage %d", usage); break; @@ -1529,6 +1536,9 @@ status_t AudioPolicyManager::dump(int fd) result.append(buffer); snprintf(buffer, SIZE, " Force use for system %d\n", mForceUse[AUDIO_POLICY_FORCE_FOR_SYSTEM]); result.append(buffer); + snprintf(buffer, SIZE, " Force use for hdmi system audio %d\n", + mForceUse[AUDIO_POLICY_FORCE_FOR_HDMI_SYSTEM_AUDIO]); + result.append(buffer); snprintf(buffer, SIZE, " Available output devices:\n"); result.append(buffer); @@ -3554,10 +3564,10 @@ audio_devices_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strate } int device3 = AUDIO_DEVICE_NONE; if (strategy == STRATEGY_MEDIA) { - // ARC, SPDIF and LINE can co-exist with others. + // ARC, SPDIF and AUX_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); + device3 |= (availableOutputDeviceTypes & AUDIO_DEVICE_OUT_AUX_LINE); } device2 |= device3; @@ -3565,6 +3575,13 @@ audio_devices_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strate // STRATEGY_ENFORCED_AUDIBLE, AUDIO_DEVICE_NONE otherwise device |= device2; + // If hdmi system audio mode is on, remove speaker out of output list. + if ((strategy == STRATEGY_MEDIA) && + (mForceUse[AUDIO_POLICY_FORCE_FOR_HDMI_SYSTEM_AUDIO] == + AUDIO_POLICY_FORCE_HDMI_SYSTEM_AUDIO_ENFORCED)) { + device &= ~AUDIO_DEVICE_OUT_SPEAKER; + } + if (device) break; device = mDefaultOutputDevice->mDeviceType; if (device == AUDIO_DEVICE_NONE) { |