diff options
author | Dhananjay Kumar <dhakumar@codeaurora.org> | 2017-06-22 19:54:37 +0530 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2017-12-18 00:37:09 +0100 |
commit | 3e07b4e41044c308c7ecb730bca301b1681a0411 (patch) | |
tree | 0c7572363b94107672114eb8431a2623f9b6901b | |
parent | cce697f9dcbbe0488d64e4af3a15cec19e30f462 (diff) | |
download | android_hardware_qcom_audio-3e07b4e41044c308c7ecb730bca301b1681a0411.tar.gz android_hardware_qcom_audio-3e07b4e41044c308c7ecb730bca301b1681a0411.tar.bz2 android_hardware_qcom_audio-3e07b4e41044c308c7ecb730bca301b1681a0411.zip |
policy_hal: update custom audio policy against OPR1.170521.001_AOSP
Update custom audio policy implementation APIs against below O-AOSP updates.
1. audio policy manager: do not reapply same forced usage
Skip systematic audio path and volume reevaluation when the new
forced configuration for the selected usage is the same as current one.
Bug: 38276985
commit: 8dc87a60e69f462e0382d025c335e45699025b48
Change-Id: Id43a5270c666065e099d02d9e52de86b20cb8039
2. audio policy: always provide a valid device address when opening a stream
Treble audio HAL mandates that a valid device address is passed when
opening an output or input stream and teh device type requires and
address.
Bug: 37905534
commit: e301410b8495a3702e21019e92d44ade2a3f81d1
Change-Id: I12f2128120b1bbe8530e8c2428e3e2cba1ba1535
3. audio policy: fix global effect attachment
Fix logic for global music effects (e.g Visualizer) attachement to
output streams.
- Consider only outputs with active music sessions first and then all
outputs
- Reevaluate effect attachment systematically on music playback start/stop
and when outputs are opened/closed
- Use the same logic every where.
Bug: 33397379
commit: 36829f97c0c547d9c6c918e248071cc616818616
Change-Id: Iabc23bc8a24f36b68942b7f32749c535781497b4
4. audio policy: disable concurrent capture
Disable concurrent capture until the corresponding UI is available.
Restore preemption for HOTWORD audio source.
Bug:36891272
commit: 74708e7c4622d65a7798d5fa9347c55583d347fe
Change-Id: I1b6c32c2a76ae0e004e14e46fedd596a8844c0d4
Change-Id: I1d59377e9892350b8f6a33de5640a90c4b6cdc5f
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index 28441ea5..4bc2df78 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -614,6 +614,9 @@ void AudioPolicyManagerCustom::setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) { ALOGD("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mEngine->getPhoneState()); + if (config == mEngine->getForceUse(usage)) { + return; + } if (mEngine->setForceUse(usage, config) != NO_ERROR) { ALOGW("setForceUse() could not set force cfg %d for usage %d", config, usage); @@ -731,6 +734,9 @@ status_t AudioPolicyManagerCustom::stopSource(const sp<AudioOutputDescriptor>& o // update the outputs if stopping one with a stream that can affect notification routing handleNotificationRoutingForStream(stream); } + if (stream == AUDIO_STREAM_MUSIC) { + selectOutputForMusicEffects(); + } return NO_ERROR; } else { ALOGW("stopOutput() refcount is already 0"); @@ -772,6 +778,10 @@ status_t AudioPolicyManagerCustom::startSource(const sp<AudioOutputDescriptor>& // necessary for a correct control of hardware output routing by startOutput() and stopOutput() outputDesc->changeRefCount(stream, 1); + if (stream == AUDIO_STREAM_MUSIC) { + selectOutputForMusicEffects(); + } + if (outputDesc->mRefCount[stream] == 1 || device != AUDIO_DEVICE_NONE) { // starting an output being rerouted? if (device == AUDIO_DEVICE_NONE) { @@ -1197,11 +1207,14 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice( if (offloadInfo != NULL) { config.offload_info = *offloadInfo; } + DeviceVector outputDevices = mAvailableOutputDevices.getDevicesFromType(device); + String8 address = outputDevices.size() > 0 ? outputDevices.itemAt(0)->mAddress + : String8(""); status = mpClientInterface->openOutput(profile->getModuleHandle(), &output, &config, &outputDesc->mDevice, - String8(""), + address, &outputDesc->mLatency, outputDesc->mFlags); @@ -1230,28 +1243,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice( outputDesc->mStopTime[stream] = 0; outputDesc->mDirectOpenCount = 1; - audio_io_handle_t srcOutput = getOutputForEffect(); 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); mpClientInterface->onAudioPortListUpdate(); |