Loading policy_hal/AudioPolicyManager.cpp +42 −0 Original line number Diff line number Diff line Loading @@ -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" Loading Loading @@ -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 Loading Loading @@ -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); Loading Loading @@ -1691,7 +1717,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); Loading Loading
policy_hal/AudioPolicyManager.cpp +42 −0 Original line number Diff line number Diff line Loading @@ -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" Loading Loading @@ -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 Loading Loading @@ -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); Loading Loading @@ -1691,7 +1717,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); Loading