Loading policy_hal/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PROXY_DEVICE)),true) LOCAL_CFLAGS += -DAUDIO_EXTN_AFE_PROXY_ENABLED endif ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FM_POWER_OPT)),true) LOCAL_CFLAGS += -DFM_POWER_OPT endif LOCAL_MODULE := libaudiopolicymanager include $(BUILD_SHARED_LIBRARY) Loading policy_hal/AudioPolicyManager.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -254,6 +254,23 @@ status_t AudioPolicyManagerCustom::setDeviceConnectionStateInt(audio_devices_t d audio_devices_t newDevice = getNewOutputDevice(mPrimaryOutput, false /*fromCache*/); updateCallRouting(newDevice); } #ifdef FM_POWER_OPT // handle FM device connection state to trigger FM AFE loopback if(device == AUDIO_DEVICE_OUT_FM && hasPrimaryOutput()) { audio_devices_t newDevice = getNewOutputDevice(mPrimaryOutput, false /*fromCache*/); if (state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE) { mPrimaryOutput->changeRefCount(AUDIO_STREAM_MUSIC, 1); newDevice = newDevice | AUDIO_DEVICE_OUT_FM; } else { mPrimaryOutput->changeRefCount(AUDIO_STREAM_MUSIC, -1); } AudioParameter param = AudioParameter(); param.addInt(String8("handle_fm"), (int)newDevice); mpClientInterface->setParameters(mPrimaryOutput->mIoHandle, param.toString()); } #endif /* FM_POWER_OPT end */ for (size_t i = 0; i < mOutputs.size(); i++) { sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i); if ((mEngine->getPhoneState() != AUDIO_MODE_IN_CALL) || (desc != mPrimaryOutput)) { Loading Loading @@ -1242,6 +1259,13 @@ status_t AudioPolicyManagerCustom::checkAndSetVolume(audio_stream_type_t stream, mpClientInterface->setVoiceVolume(voiceVolume, delayMs); mLastVoiceVolume = voiceVolume; } #ifdef FM_POWER_OPT } else if (stream == AUDIO_STREAM_MUSIC && hasPrimaryOutput() && outputDesc == mPrimaryOutput) { AudioParameter param = AudioParameter(); param.addFloat(String8("fm_volume"), Volume::DbToAmpl(volumeDb)); mpClientInterface->setParameters(mPrimaryOutput->mIoHandle, param.toString(), delayMs); #endif /* FM_POWER_OPT end */ } return NO_ERROR; Loading Loading
policy_hal/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PROXY_DEVICE)),true) LOCAL_CFLAGS += -DAUDIO_EXTN_AFE_PROXY_ENABLED endif ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FM_POWER_OPT)),true) LOCAL_CFLAGS += -DFM_POWER_OPT endif LOCAL_MODULE := libaudiopolicymanager include $(BUILD_SHARED_LIBRARY) Loading
policy_hal/AudioPolicyManager.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -254,6 +254,23 @@ status_t AudioPolicyManagerCustom::setDeviceConnectionStateInt(audio_devices_t d audio_devices_t newDevice = getNewOutputDevice(mPrimaryOutput, false /*fromCache*/); updateCallRouting(newDevice); } #ifdef FM_POWER_OPT // handle FM device connection state to trigger FM AFE loopback if(device == AUDIO_DEVICE_OUT_FM && hasPrimaryOutput()) { audio_devices_t newDevice = getNewOutputDevice(mPrimaryOutput, false /*fromCache*/); if (state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE) { mPrimaryOutput->changeRefCount(AUDIO_STREAM_MUSIC, 1); newDevice = newDevice | AUDIO_DEVICE_OUT_FM; } else { mPrimaryOutput->changeRefCount(AUDIO_STREAM_MUSIC, -1); } AudioParameter param = AudioParameter(); param.addInt(String8("handle_fm"), (int)newDevice); mpClientInterface->setParameters(mPrimaryOutput->mIoHandle, param.toString()); } #endif /* FM_POWER_OPT end */ for (size_t i = 0; i < mOutputs.size(); i++) { sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i); if ((mEngine->getPhoneState() != AUDIO_MODE_IN_CALL) || (desc != mPrimaryOutput)) { Loading Loading @@ -1242,6 +1259,13 @@ status_t AudioPolicyManagerCustom::checkAndSetVolume(audio_stream_type_t stream, mpClientInterface->setVoiceVolume(voiceVolume, delayMs); mLastVoiceVolume = voiceVolume; } #ifdef FM_POWER_OPT } else if (stream == AUDIO_STREAM_MUSIC && hasPrimaryOutput() && outputDesc == mPrimaryOutput) { AudioParameter param = AudioParameter(); param.addFloat(String8("fm_volume"), Volume::DbToAmpl(volumeDb)); mpClientInterface->setParameters(mPrimaryOutput->mIoHandle, param.toString(), delayMs); #endif /* FM_POWER_OPT end */ } return NO_ERROR; Loading