diff options
-rw-r--r-- | audio/audio_hw.c | 34 | ||||
-rw-r--r-- | overlay/packages/apps/Phone | 1 | ||||
-rw-r--r-- | overlay/packages/services/Telephony/res/values/config.xml | 23 |
3 files changed, 19 insertions, 39 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index e3cf20a..283fb30 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -200,6 +200,7 @@ struct m0_dev_cfg { static void select_output_device(struct m0_audio_device *adev); static void select_input_device(struct m0_audio_device *adev); +static void set_noise_supression(struct m0_audio_device *adev, int enable); static int adev_set_voice_volume(struct audio_hw_device *dev, float volume); static int do_input_standby(struct m0_stream_in *in); static int do_output_standby(struct m0_stream_out *out); @@ -593,6 +594,7 @@ static void select_mode(struct m0_audio_device *adev) set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); ALOGD("%s: set voicecall route: default_input_disable", __func__); set_bigroute_by_array(adev->mixer, default_input_disable, 1); + set_noise_supression(adev, 0); ALOGD("%s: set voicecall route: headset_input_disable", __func__); set_bigroute_by_array(adev->mixer, headset_input_disable, 1); ALOGD("%s: set voicecall route: bt_disable", __func__); @@ -671,9 +673,11 @@ static void select_output_device(struct m0_audio_device *adev) if (speaker_on || earpiece_on || headphone_on) { ALOGD("%s: set voicecall route: default_input", __func__); set_bigroute_by_array(adev->mixer, default_input, 1); + set_noise_supression(adev, 1); } else { ALOGD("%s: set voicecall route: default_input_disable", __func__); set_bigroute_by_array(adev->mixer, default_input_disable, 1); + set_noise_supression(adev, 0); } if (headset_on) { @@ -723,6 +727,21 @@ static void select_input_device(struct m0_audio_device *adev) select_devices(adev); } +static void set_noise_supression(struct m0_audio_device *adev, int enable) +{ + if (enable) { + // Enable Noise suppression for builtin microphone + ALOGE("%s: enabling two mic control", __func__); + ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); + set_bigroute_by_array(adev->mixer, noise_suppression, 1); + } else { + // Disable Noise suppression for builtin microphone + ALOGE("%s: disabling two mic control", __func__); + ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); + set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); + } +} + /* must be called with hw device and output stream mutexes locked */ static int start_output_stream_low_latency(struct m0_stream_out *out) { @@ -2540,21 +2559,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) adev->screen_off = true; } - ret = str_parms_get_str(parms, "noise_suppression", value, sizeof(value)); - if (ret >= 0) { - if (strcmp(value, "on") == 0) { - ALOGE("%s: enabling two mic control", __func__); - ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression, 1); - } else { - ALOGE("%s: disabling two mic control", __func__); - ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); - } - } - str_parms_destroy(parms); return ret; } diff --git a/overlay/packages/apps/Phone b/overlay/packages/apps/Phone deleted file mode 100644 index 0f8d39e..0000000 --- a/overlay/packages/apps/Phone +++ /dev/null @@ -1 +0,0 @@ -../services/Telephony/
\ No newline at end of file diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml deleted file mode 100644 index f65c593..0000000 --- a/overlay/packages/services/Telephony/res/values/config.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project - - 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. ---> - -<!-- Phone app resources that may need to be customized - for different hardware or product builds. --> - -<resources> - <!-- Determines if device implements a noise suppression device for in call audio--> - <bool name="has_in_call_noise_suppression">true</bool> -</resources> |