diff options
author | Gao Jie <jzgao@dolby.com> | 2015-11-12 08:51:22 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-11-25 06:34:37 -0800 |
commit | 6d4ef37017f9806026713d5451f8b550c4129a0b (patch) | |
tree | c660cf369d0c4930a790181227e70faf0a7564e5 | |
parent | 30a54ef22488f95a8865c9422130f1e1597b3bdd (diff) | |
download | hardware_qcom_audio-6d4ef37017f9806026713d5451f8b550c4129a0b.tar.gz hardware_qcom_audio-6d4ef37017f9806026713d5451f8b550c4129a0b.tar.bz2 hardware_qcom_audio-6d4ef37017f9806026713d5451f8b550c4129a0b.zip |
Merge DAX2 changes
Change-Id: If6fcfdef0b051f9015c127bdd7d28e3668e47435
(cherry picked from commit 4879ebb6d14558695044be0a22a89fc8b7ac24ec)
Change-Id: I5ecf6c792bf1d5c481879a38231acfdb2a3ccc3e
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index 2b567b18..c32fafb6 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -15,6 +15,24 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * This file was modified by Dolby Laboratories, Inc. The portions of the + * code that are surrounded by "DOLBY..." are copyrighted and + * licensed separately, as follows: + * + * (C) 2015 Dolby Laboratories, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #define LOG_TAG "AudioPolicyManagerCustom" @@ -46,6 +64,9 @@ #include <soundtrigger/SoundTrigger.h> #include "AudioPolicyManager.h" #include <policy.h> +#ifdef DOLBY_ENABLE +#include "DolbyAudioPolicy_impl.h" +#endif // DOLBY_END namespace android { #ifdef VOICE_CONCURRENCY @@ -246,6 +267,11 @@ status_t AudioPolicyManagerCustom::setDeviceConnectionStateInt(audio_devices_t d } updateDevicesAndOutputs(); +#ifdef DOLBY_ENABLE + // Before closing the opened outputs, update endpoint property with device capabilities + audio_devices_t audioOutputDevice = getDeviceForStrategy(getStrategy(AUDIO_STREAM_MUSIC), true); + mDolbyAudioPolicy.setEndpointSystemProperty(audioOutputDevice, mHwModules); +#endif // DOLBY_END if (mEngine->getPhoneState() == AUDIO_MODE_IN_CALL && hasPrimaryOutput()) { audio_devices_t newDevice = getNewOutputDevice(mPrimaryOutput, false /*fromCache*/); updateCallRouting(newDevice); @@ -1619,7 +1645,23 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice( addOutput(output, outputDesc); audio_io_handle_t dstOutput = getOutputForEffect(); if (dstOutput == output) { +#ifdef DOLBY_ENABLE + status_t status = mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX, srcOutput, dstOutput); + if (status == NO_ERROR) { + for (size_t i = 0; i < mEffects.size(); i++) { + sp<EffectDescriptor> desc = mEffects.valueAt(i); + if (desc->mSession == AUDIO_SESSION_OUTPUT_MIX) { + // update the mIo member of EffectDescriptor for the global effect + ALOGV("%s updating mIo", __FUNCTION__); + desc->mIo = dstOutput; + } + } + } else { + ALOGW("%s moveEffects from %d to %d failed", __FUNCTION__, srcOutput, dstOutput); + } +#else // DOLBY_END mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX, srcOutput, dstOutput); +#endif // LINE_ADDED_BY_DOLBY } mPreviousOutputs = mOutputs; ALOGV("getOutput() returns new direct output %d", output); |