Loading services/audiopolicy/engine/common/src/EngineBase.cpp +1 −14 Original line number Diff line number Diff line Loading @@ -70,20 +70,7 @@ product_strategy_t EngineBase::getProductStrategyForAttributes(const audio_attri audio_stream_type_t EngineBase::getStreamTypeForAttributes(const audio_attributes_t &attr) const { audio_stream_type_t engineStream = mProductStrategies.getStreamTypeForAttributes(attr); // ensure the audibility flag for sonification is honored for stream types // Note this is typically implemented in the product strategy configuration files, but is // duplicated here for safety. if (attr.usage == AUDIO_USAGE_ASSISTANCE_SONIFICATION && ((attr.flags & AUDIO_FLAG_AUDIBILITY_ENFORCED) != 0)) { engineStream = AUDIO_STREAM_ENFORCED_AUDIBLE; } // ensure the ENFORCED_AUDIBLE stream type reflects the "force use" setting: if ((getForceUse(AUDIO_POLICY_FORCE_FOR_SYSTEM) != AUDIO_POLICY_FORCE_SYSTEM_ENFORCED) && (engineStream == AUDIO_STREAM_ENFORCED_AUDIBLE)) { return AUDIO_STREAM_SYSTEM; } return engineStream; return mProductStrategies.getStreamTypeForAttributes(attr); } audio_attributes_t EngineBase::getAttributesForStreamType(audio_stream_type_t stream) const Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -777,6 +777,12 @@ void AudioPolicyManager::setForceUse(audio_policy_force_use_t usage, // check for device and output changes triggered by new force usage checkForDeviceAndOutputChanges(); // force client reconnection to reevaluate flag AUDIO_FLAG_AUDIBILITY_ENFORCED if (usage == AUDIO_POLICY_FORCE_FOR_SYSTEM) { mpClientInterface->invalidateStream(AUDIO_STREAM_SYSTEM); mpClientInterface->invalidateStream(AUDIO_STREAM_ENFORCED_AUDIBLE); } //FIXME: workaround for truncated touch sounds // to be removed when the problem is handled by system UI uint32_t delayMs = 0; Loading Loading @@ -910,6 +916,13 @@ status_t AudioPolicyManager::getAudioAttributes(audio_attributes_t *dstAttr, } *dstAttr = mEngine->getAttributesForStreamType(srcStream); } // Only honor audibility enforced when required. The client will be // forced to reconnect if the forced usage changes. if (mEngine->getForceUse(AUDIO_POLICY_FORCE_FOR_SYSTEM) != AUDIO_POLICY_FORCE_SYSTEM_ENFORCED) { dstAttr->flags &= ~AUDIO_FLAG_AUDIBILITY_ENFORCED; } return NO_ERROR; } Loading Loading
services/audiopolicy/engine/common/src/EngineBase.cpp +1 −14 Original line number Diff line number Diff line Loading @@ -70,20 +70,7 @@ product_strategy_t EngineBase::getProductStrategyForAttributes(const audio_attri audio_stream_type_t EngineBase::getStreamTypeForAttributes(const audio_attributes_t &attr) const { audio_stream_type_t engineStream = mProductStrategies.getStreamTypeForAttributes(attr); // ensure the audibility flag for sonification is honored for stream types // Note this is typically implemented in the product strategy configuration files, but is // duplicated here for safety. if (attr.usage == AUDIO_USAGE_ASSISTANCE_SONIFICATION && ((attr.flags & AUDIO_FLAG_AUDIBILITY_ENFORCED) != 0)) { engineStream = AUDIO_STREAM_ENFORCED_AUDIBLE; } // ensure the ENFORCED_AUDIBLE stream type reflects the "force use" setting: if ((getForceUse(AUDIO_POLICY_FORCE_FOR_SYSTEM) != AUDIO_POLICY_FORCE_SYSTEM_ENFORCED) && (engineStream == AUDIO_STREAM_ENFORCED_AUDIBLE)) { return AUDIO_STREAM_SYSTEM; } return engineStream; return mProductStrategies.getStreamTypeForAttributes(attr); } audio_attributes_t EngineBase::getAttributesForStreamType(audio_stream_type_t stream) const Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -777,6 +777,12 @@ void AudioPolicyManager::setForceUse(audio_policy_force_use_t usage, // check for device and output changes triggered by new force usage checkForDeviceAndOutputChanges(); // force client reconnection to reevaluate flag AUDIO_FLAG_AUDIBILITY_ENFORCED if (usage == AUDIO_POLICY_FORCE_FOR_SYSTEM) { mpClientInterface->invalidateStream(AUDIO_STREAM_SYSTEM); mpClientInterface->invalidateStream(AUDIO_STREAM_ENFORCED_AUDIBLE); } //FIXME: workaround for truncated touch sounds // to be removed when the problem is handled by system UI uint32_t delayMs = 0; Loading Loading @@ -910,6 +916,13 @@ status_t AudioPolicyManager::getAudioAttributes(audio_attributes_t *dstAttr, } *dstAttr = mEngine->getAttributesForStreamType(srcStream); } // Only honor audibility enforced when required. The client will be // forced to reconnect if the forced usage changes. if (mEngine->getForceUse(AUDIO_POLICY_FORCE_FOR_SYSTEM) != AUDIO_POLICY_FORCE_SYSTEM_ENFORCED) { dstAttr->flags &= ~AUDIO_FLAG_AUDIBILITY_ENFORCED; } return NO_ERROR; } Loading