diff options
author | Weiyin Jiang <wjiang@codeaurora.org> | 2016-02-16 15:55:11 +0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-04-27 20:46:30 -0700 |
commit | a88dde52dd21e4251aea601c9d50710dd016dd95 (patch) | |
tree | 80c0ee29fc3dd6c4321d0d9f68d4e8a2341941be | |
parent | d25d8532d698a5e53352a27c66b005e41bfa384f (diff) | |
download | hardware_qcom_audio-a88dde52dd21e4251aea601c9d50710dd016dd95.tar.gz hardware_qcom_audio-a88dde52dd21e4251aea601c9d50710dd016dd95.tar.bz2 hardware_qcom_audio-a88dde52dd21e4251aea601c9d50710dd016dd95.zip |
policy_hal: handle incall sonification without checking output refCount
Call handleIncallSonification in startSource and stopSource without
checking mRefCount to make sure ringtone mute/unmute is called for
multiple active stream.
Change-Id: I52290f9ae09dff3619ac3a36c8969da6c07853ec
CRs-Fixed: 972582
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index 09747ebe..408b90da 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. * Not a contribution. * * Copyright (C) 2009 The Android Open Source Project @@ -397,6 +397,7 @@ status_t AudioPolicyManagerCustom::setDeviceConnectionStateInt(audio_devices_t d ALOGW("setDeviceConnectionState() invalid device: %x", device); return BAD_VALUE; } + // This function checks for the parameters which can be offloaded. // This can be enhanced depending on the capability of the DSP and policy // of the system. @@ -568,6 +569,7 @@ bool AudioPolicyManagerCustom::isOffloadSupported(const audio_offload_info_t& of ALOGV("isOffloadSupported() profile %sfound", profile != 0 ? "" : "NOT "); return (profile != 0); } + audio_devices_t AudioPolicyManagerCustom::getNewOutputDevice(const sp<AudioOutputDescriptor>& outputDesc, bool fromCache) { @@ -633,6 +635,7 @@ audio_devices_t AudioPolicyManagerCustom::getNewOutputDevice(const sp<AudioOutpu ALOGV("getNewOutputDevice() selected device %x", device); return device; } + void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state) { ALOGV("setPhoneState() state %d", state); @@ -968,7 +971,7 @@ status_t AudioPolicyManagerCustom::stopSource(sp<AudioOutputDescriptor> outputDe handleEventForBeacon(stream == AUDIO_STREAM_TTS ? STOPPING_BEACON : STOPPING_OUTPUT); // handle special case for sonification while in call - if (isInCall() && (outputDesc->mRefCount[stream] == 1)) { + if (isInCall()) { if (outputDesc->isDuplicated()) { handleIncallSonification(stream, false, false, outputDesc->subOutput1()->mIoHandle); handleIncallSonification(stream, false, false, outputDesc->subOutput2()->mIoHandle); @@ -1023,6 +1026,7 @@ status_t AudioPolicyManagerCustom::stopSource(sp<AudioOutputDescriptor> outputDe return INVALID_OPERATION; } } + status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputDesc, audio_stream_type_t stream, audio_devices_t device, @@ -1108,13 +1112,14 @@ status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputD } } else { - // handle special case for sonification while in call - if (isInCall()) { - handleIncallSonification(stream, true, false, outputDesc->mIoHandle); - } + // handle special case for sonification while in call + if (isInCall()) { + handleIncallSonification(stream, true, false, outputDesc->mIoHandle); } + } return NO_ERROR; } + void AudioPolicyManagerCustom::handleIncallSonification(audio_stream_type_t stream, bool starting, bool stateChange, audio_io_handle_t output) @@ -1167,6 +1172,7 @@ void AudioPolicyManagerCustom::handleIncallSonification(audio_stream_type_t stre } } } + void AudioPolicyManagerCustom::handleNotificationRoutingForStream(audio_stream_type_t stream) { switch(stream) { case AUDIO_STREAM_MUSIC: @@ -1177,6 +1183,7 @@ void AudioPolicyManagerCustom::handleNotificationRoutingForStream(audio_stream_t break; } } + status_t AudioPolicyManagerCustom::checkAndSetVolume(audio_stream_type_t stream, int index, const sp<AudioOutputDescriptor>& outputDesc, @@ -1246,6 +1253,7 @@ status_t AudioPolicyManagerCustom::checkAndSetVolume(audio_stream_type_t stream, return NO_ERROR; } + bool AudioPolicyManagerCustom::isDirectOutput(audio_io_handle_t output) { for (size_t i = 0; i < mOutputs.size(); i++) { audio_io_handle_t curOutput = mOutputs.keyAt(i); @@ -1799,6 +1807,7 @@ status_t AudioPolicyManagerCustom::getInputForAttr(const audio_attributes_t *att selectedDeviceId, inputType); } + status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input, audio_session_t session) { @@ -1922,6 +1931,7 @@ status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input, #endif return NO_ERROR; } + status_t AudioPolicyManagerCustom::stopInput(audio_io_handle_t input, audio_session_t session) { |