Loading services/audiopolicy/AudioPolicyInterface.h +0 −5 Original line number Diff line number Diff line Loading @@ -324,11 +324,6 @@ public: // function enabling to receive proprietary informations directly from audio hardware interface to audio policy manager. virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys) = 0; // request the playback of a tone on the specified stream: used for instance to replace notification sounds when playing // over a telephony device during a phone call. virtual status_t startTone(audio_policy_tone_t tone, audio_stream_type_t stream) = 0; virtual status_t stopTone() = 0; // set down link audio volume. virtual status_t setVoiceVolume(float volume, int delayMs = 0) = 0; Loading services/audiopolicy/enginedefault/src/Engine.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -408,8 +408,7 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy, case STRATEGY_SONIFICATION: // If incall, just select the STRATEGY_PHONE device: The rest of the behavior is handled by // handleIncallSonification(). // If incall, just select the STRATEGY_PHONE device if (isInCall() || outputs.isStreamActiveLocally(AUDIO_STREAM_VOICE_CALL)) { device = getDeviceForStrategyInt( STRATEGY_PHONE, availableOutputDevices, availableInputDevices, outputs, Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +6 −78 Original line number Diff line number Diff line Loading @@ -551,14 +551,8 @@ void AudioPolicyManager::setPhoneState(audio_mode_t state) return; } /// Opens: can these line be executed after the switch of volume curves??? // if leaving call state, handle special case of active streams // pertaining to sonification strategy see handleIncallSonification() if (isStateInCall(oldState)) { ALOGV("setPhoneState() in call state management: new state is %d", state); for (int stream = 0; stream < AUDIO_STREAM_FOR_POLICY_CNT; stream++) { handleIncallSonification((audio_stream_type_t)stream, false, true); } // force reevaluating accessibility routing when call stops mpClientInterface->invalidateStream(AUDIO_STREAM_ACCESSIBILITY); } Loading Loading @@ -637,14 +631,8 @@ void AudioPolicyManager::setPhoneState(audio_mode_t state) } } // if entering in call state, handle special case of active streams // pertaining to sonification strategy see handleIncallSonification() if (isStateInCall(state)) { ALOGV("setPhoneState() in call state management: new state is %d", state); for (int stream = 0; stream < AUDIO_STREAM_FOR_POLICY_CNT; stream++) { handleIncallSonification((audio_stream_type_t)stream, true, true); } // force reevaluating accessibility routing when call starts mpClientInterface->invalidateStream(AUDIO_STREAM_ACCESSIBILITY); } Loading Loading @@ -1279,11 +1267,6 @@ status_t AudioPolicyManager::startSource(const sp<AudioOutputDescriptor>& output const uint32_t muteWaitMs = setOutputDevice(outputDesc, device, force, 0, NULL, address, requiresMuteCheck); // handle special case for sonification while in call if (isInCall()) { handleIncallSonification(stream, true, false); } // apply volume rules for current stream and device if necessary checkAndSetVolume(stream, mVolumeCurves->getVolumeIndex(stream, outputDesc->device()), Loading Loading @@ -1378,11 +1361,6 @@ status_t AudioPolicyManager::stopSource(const sp<AudioOutputDescriptor>& outputD // always handle stream stop, check which stream type is stopping handleEventForBeacon(stream == AUDIO_STREAM_TTS ? STOPPING_BEACON : STOPPING_OUTPUT); // handle special case for sonification while in call if (isInCall()) { handleIncallSonification(stream, false, false); } if (outputDesc->mRefCount[stream] > 0) { // decrement usage count of this stream on the output outputDesc->changeRefCount(stream, -1); Loading Loading @@ -2273,11 +2251,10 @@ status_t AudioPolicyManager::setStreamVolumeIndex(audio_stream_type_t stream, sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i); audio_devices_t curDevice = Volume::getDeviceForVolume(desc->device()); for (int curStream = 0; curStream < AUDIO_STREAM_FOR_POLICY_CNT; curStream++) { if (!streamsMatchForvolume(stream, (audio_stream_type_t)curStream)) { if (!(streamsMatchForvolume(stream, (audio_stream_type_t)curStream) || isInCall())) { continue; } if (!(desc->isStreamActive((audio_stream_type_t)curStream) || (isInCall() && (curStream == AUDIO_STREAM_VOICE_CALL)))) { if (!(desc->isStreamActive((audio_stream_type_t)curStream) || isInCall())) { continue; } routing_strategy curStrategy = getStrategy((audio_stream_type_t)curStream); Loading Loading @@ -5423,8 +5400,8 @@ float AudioPolicyManager::computeVolume(audio_stream_type_t stream, return ringVolumeDB - 4 > volumeDB ? ringVolumeDB - 4 : volumeDB; } // in-call: always cap earpiece volume by voice volume + some low headroom if ((stream != AUDIO_STREAM_VOICE_CALL) && (device & AUDIO_DEVICE_OUT_EARPIECE) && // in-call: always cap volume by voice volume + some low headroom if ((stream != AUDIO_STREAM_VOICE_CALL) && (isInCall() || mOutputs.isStreamActiveLocally(AUDIO_STREAM_VOICE_CALL))) { switch (stream) { case AUDIO_STREAM_SYSTEM: Loading @@ -5436,9 +5413,9 @@ float AudioPolicyManager::computeVolume(audio_stream_type_t stream, case AUDIO_STREAM_DTMF: case AUDIO_STREAM_ACCESSIBILITY: { int voiceVolumeIndex = mVolumeCurves->getVolumeIndex(AUDIO_STREAM_VOICE_CALL, AUDIO_DEVICE_OUT_EARPIECE); mVolumeCurves->getVolumeIndex(AUDIO_STREAM_VOICE_CALL, device); const float maxVoiceVolDb = computeVolume(AUDIO_STREAM_VOICE_CALL, voiceVolumeIndex, AUDIO_DEVICE_OUT_EARPIECE) computeVolume(AUDIO_STREAM_VOICE_CALL, voiceVolumeIndex, device) + IN_CALL_EARPIECE_HEADROOM_DB; if (volumeDB > maxVoiceVolDb) { ALOGV("computeVolume() stream %d at vol=%f overriden by stream %d at vol=%f", Loading Loading @@ -5635,55 +5612,6 @@ void AudioPolicyManager::setStreamMute(audio_stream_type_t stream, } } void AudioPolicyManager::handleIncallSonification(audio_stream_type_t stream, bool starting, bool stateChange) { if(!hasPrimaryOutput()) { return; } // if the stream pertains to sonification strategy and we are in call we must // mute the stream if it is low visibility. If it is high visibility, we must play a tone // in the device used for phone strategy and play the tone if the selected device does not // interfere with the device used for phone strategy // if stateChange is true, we are called from setPhoneState() and we must mute or unmute as // many times as there are active tracks on the output const routing_strategy stream_strategy = getStrategy(stream); if ((stream_strategy == STRATEGY_SONIFICATION) || ((stream_strategy == STRATEGY_SONIFICATION_RESPECTFUL))) { sp<SwAudioOutputDescriptor> outputDesc = mPrimaryOutput; ALOGV("handleIncallSonification() stream %d starting %d device %x stateChange %d", stream, starting, outputDesc->mDevice, stateChange); if (outputDesc->mRefCount[stream]) { int muteCount = 1; if (stateChange) { muteCount = outputDesc->mRefCount[stream]; } if (audio_is_low_visibility(stream)) { ALOGV("handleIncallSonification() low visibility, muteCount %d", muteCount); for (int i = 0; i < muteCount; i++) { setStreamMute(stream, starting, mPrimaryOutput); } } else { ALOGV("handleIncallSonification() high visibility"); if (outputDesc->device() & getDeviceForStrategy(STRATEGY_PHONE, true /*fromCache*/)) { ALOGV("handleIncallSonification() high visibility muted, muteCount %d", muteCount); for (int i = 0; i < muteCount; i++) { setStreamMute(stream, starting, mPrimaryOutput); } } if (starting) { mpClientInterface->startTone(AUDIO_POLICY_TONE_IN_CALL_NOTIFICATION, AUDIO_STREAM_VOICE_CALL); } else { mpClientInterface->stopTone(); } } } } } audio_stream_type_t AudioPolicyManager::streamTypefromAttributesInt(const audio_attributes_t *attr) { // flags to stream type mapping Loading services/audiopolicy/managerdefault/AudioPolicyManager.h +0 −4 Original line number Diff line number Diff line Loading @@ -377,10 +377,6 @@ protected: int delayMs = 0, audio_devices_t device = (audio_devices_t)0); // handle special cases for sonification strategy while in call: mute streams or replace by // a special tone in the device used for communication void handleIncallSonification(audio_stream_type_t stream, bool starting, bool stateChange); audio_mode_t getPhoneState(); // true if device is in a telephony or VoIP call Loading services/audiopolicy/service/AudioPolicyClientImpl.cpp +0 −11 Original line number Diff line number Diff line Loading @@ -155,17 +155,6 @@ String8 AudioPolicyService::AudioPolicyClient::getParameters(audio_io_handle_t i return result; } status_t AudioPolicyService::AudioPolicyClient::startTone(audio_policy_tone_t tone, audio_stream_type_t stream) { return mAudioPolicyService->startTone(tone, stream); } status_t AudioPolicyService::AudioPolicyClient::stopTone() { return mAudioPolicyService->stopTone(); } status_t AudioPolicyService::AudioPolicyClient::setVoiceVolume(float volume, int delay_ms) { return mAudioPolicyService->setVoiceVolume(volume, delay_ms); Loading Loading
services/audiopolicy/AudioPolicyInterface.h +0 −5 Original line number Diff line number Diff line Loading @@ -324,11 +324,6 @@ public: // function enabling to receive proprietary informations directly from audio hardware interface to audio policy manager. virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys) = 0; // request the playback of a tone on the specified stream: used for instance to replace notification sounds when playing // over a telephony device during a phone call. virtual status_t startTone(audio_policy_tone_t tone, audio_stream_type_t stream) = 0; virtual status_t stopTone() = 0; // set down link audio volume. virtual status_t setVoiceVolume(float volume, int delayMs = 0) = 0; Loading
services/audiopolicy/enginedefault/src/Engine.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -408,8 +408,7 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy, case STRATEGY_SONIFICATION: // If incall, just select the STRATEGY_PHONE device: The rest of the behavior is handled by // handleIncallSonification(). // If incall, just select the STRATEGY_PHONE device if (isInCall() || outputs.isStreamActiveLocally(AUDIO_STREAM_VOICE_CALL)) { device = getDeviceForStrategyInt( STRATEGY_PHONE, availableOutputDevices, availableInputDevices, outputs, Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +6 −78 Original line number Diff line number Diff line Loading @@ -551,14 +551,8 @@ void AudioPolicyManager::setPhoneState(audio_mode_t state) return; } /// Opens: can these line be executed after the switch of volume curves??? // if leaving call state, handle special case of active streams // pertaining to sonification strategy see handleIncallSonification() if (isStateInCall(oldState)) { ALOGV("setPhoneState() in call state management: new state is %d", state); for (int stream = 0; stream < AUDIO_STREAM_FOR_POLICY_CNT; stream++) { handleIncallSonification((audio_stream_type_t)stream, false, true); } // force reevaluating accessibility routing when call stops mpClientInterface->invalidateStream(AUDIO_STREAM_ACCESSIBILITY); } Loading Loading @@ -637,14 +631,8 @@ void AudioPolicyManager::setPhoneState(audio_mode_t state) } } // if entering in call state, handle special case of active streams // pertaining to sonification strategy see handleIncallSonification() if (isStateInCall(state)) { ALOGV("setPhoneState() in call state management: new state is %d", state); for (int stream = 0; stream < AUDIO_STREAM_FOR_POLICY_CNT; stream++) { handleIncallSonification((audio_stream_type_t)stream, true, true); } // force reevaluating accessibility routing when call starts mpClientInterface->invalidateStream(AUDIO_STREAM_ACCESSIBILITY); } Loading Loading @@ -1279,11 +1267,6 @@ status_t AudioPolicyManager::startSource(const sp<AudioOutputDescriptor>& output const uint32_t muteWaitMs = setOutputDevice(outputDesc, device, force, 0, NULL, address, requiresMuteCheck); // handle special case for sonification while in call if (isInCall()) { handleIncallSonification(stream, true, false); } // apply volume rules for current stream and device if necessary checkAndSetVolume(stream, mVolumeCurves->getVolumeIndex(stream, outputDesc->device()), Loading Loading @@ -1378,11 +1361,6 @@ status_t AudioPolicyManager::stopSource(const sp<AudioOutputDescriptor>& outputD // always handle stream stop, check which stream type is stopping handleEventForBeacon(stream == AUDIO_STREAM_TTS ? STOPPING_BEACON : STOPPING_OUTPUT); // handle special case for sonification while in call if (isInCall()) { handleIncallSonification(stream, false, false); } if (outputDesc->mRefCount[stream] > 0) { // decrement usage count of this stream on the output outputDesc->changeRefCount(stream, -1); Loading Loading @@ -2273,11 +2251,10 @@ status_t AudioPolicyManager::setStreamVolumeIndex(audio_stream_type_t stream, sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i); audio_devices_t curDevice = Volume::getDeviceForVolume(desc->device()); for (int curStream = 0; curStream < AUDIO_STREAM_FOR_POLICY_CNT; curStream++) { if (!streamsMatchForvolume(stream, (audio_stream_type_t)curStream)) { if (!(streamsMatchForvolume(stream, (audio_stream_type_t)curStream) || isInCall())) { continue; } if (!(desc->isStreamActive((audio_stream_type_t)curStream) || (isInCall() && (curStream == AUDIO_STREAM_VOICE_CALL)))) { if (!(desc->isStreamActive((audio_stream_type_t)curStream) || isInCall())) { continue; } routing_strategy curStrategy = getStrategy((audio_stream_type_t)curStream); Loading Loading @@ -5423,8 +5400,8 @@ float AudioPolicyManager::computeVolume(audio_stream_type_t stream, return ringVolumeDB - 4 > volumeDB ? ringVolumeDB - 4 : volumeDB; } // in-call: always cap earpiece volume by voice volume + some low headroom if ((stream != AUDIO_STREAM_VOICE_CALL) && (device & AUDIO_DEVICE_OUT_EARPIECE) && // in-call: always cap volume by voice volume + some low headroom if ((stream != AUDIO_STREAM_VOICE_CALL) && (isInCall() || mOutputs.isStreamActiveLocally(AUDIO_STREAM_VOICE_CALL))) { switch (stream) { case AUDIO_STREAM_SYSTEM: Loading @@ -5436,9 +5413,9 @@ float AudioPolicyManager::computeVolume(audio_stream_type_t stream, case AUDIO_STREAM_DTMF: case AUDIO_STREAM_ACCESSIBILITY: { int voiceVolumeIndex = mVolumeCurves->getVolumeIndex(AUDIO_STREAM_VOICE_CALL, AUDIO_DEVICE_OUT_EARPIECE); mVolumeCurves->getVolumeIndex(AUDIO_STREAM_VOICE_CALL, device); const float maxVoiceVolDb = computeVolume(AUDIO_STREAM_VOICE_CALL, voiceVolumeIndex, AUDIO_DEVICE_OUT_EARPIECE) computeVolume(AUDIO_STREAM_VOICE_CALL, voiceVolumeIndex, device) + IN_CALL_EARPIECE_HEADROOM_DB; if (volumeDB > maxVoiceVolDb) { ALOGV("computeVolume() stream %d at vol=%f overriden by stream %d at vol=%f", Loading Loading @@ -5635,55 +5612,6 @@ void AudioPolicyManager::setStreamMute(audio_stream_type_t stream, } } void AudioPolicyManager::handleIncallSonification(audio_stream_type_t stream, bool starting, bool stateChange) { if(!hasPrimaryOutput()) { return; } // if the stream pertains to sonification strategy and we are in call we must // mute the stream if it is low visibility. If it is high visibility, we must play a tone // in the device used for phone strategy and play the tone if the selected device does not // interfere with the device used for phone strategy // if stateChange is true, we are called from setPhoneState() and we must mute or unmute as // many times as there are active tracks on the output const routing_strategy stream_strategy = getStrategy(stream); if ((stream_strategy == STRATEGY_SONIFICATION) || ((stream_strategy == STRATEGY_SONIFICATION_RESPECTFUL))) { sp<SwAudioOutputDescriptor> outputDesc = mPrimaryOutput; ALOGV("handleIncallSonification() stream %d starting %d device %x stateChange %d", stream, starting, outputDesc->mDevice, stateChange); if (outputDesc->mRefCount[stream]) { int muteCount = 1; if (stateChange) { muteCount = outputDesc->mRefCount[stream]; } if (audio_is_low_visibility(stream)) { ALOGV("handleIncallSonification() low visibility, muteCount %d", muteCount); for (int i = 0; i < muteCount; i++) { setStreamMute(stream, starting, mPrimaryOutput); } } else { ALOGV("handleIncallSonification() high visibility"); if (outputDesc->device() & getDeviceForStrategy(STRATEGY_PHONE, true /*fromCache*/)) { ALOGV("handleIncallSonification() high visibility muted, muteCount %d", muteCount); for (int i = 0; i < muteCount; i++) { setStreamMute(stream, starting, mPrimaryOutput); } } if (starting) { mpClientInterface->startTone(AUDIO_POLICY_TONE_IN_CALL_NOTIFICATION, AUDIO_STREAM_VOICE_CALL); } else { mpClientInterface->stopTone(); } } } } } audio_stream_type_t AudioPolicyManager::streamTypefromAttributesInt(const audio_attributes_t *attr) { // flags to stream type mapping Loading
services/audiopolicy/managerdefault/AudioPolicyManager.h +0 −4 Original line number Diff line number Diff line Loading @@ -377,10 +377,6 @@ protected: int delayMs = 0, audio_devices_t device = (audio_devices_t)0); // handle special cases for sonification strategy while in call: mute streams or replace by // a special tone in the device used for communication void handleIncallSonification(audio_stream_type_t stream, bool starting, bool stateChange); audio_mode_t getPhoneState(); // true if device is in a telephony or VoIP call Loading
services/audiopolicy/service/AudioPolicyClientImpl.cpp +0 −11 Original line number Diff line number Diff line Loading @@ -155,17 +155,6 @@ String8 AudioPolicyService::AudioPolicyClient::getParameters(audio_io_handle_t i return result; } status_t AudioPolicyService::AudioPolicyClient::startTone(audio_policy_tone_t tone, audio_stream_type_t stream) { return mAudioPolicyService->startTone(tone, stream); } status_t AudioPolicyService::AudioPolicyClient::stopTone() { return mAudioPolicyService->stopTone(); } status_t AudioPolicyService::AudioPolicyClient::setVoiceVolume(float volume, int delay_ms) { return mAudioPolicyService->setVoiceVolume(volume, delay_ms); Loading