rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | ########################################################### |
| 2 | ## Options to be translated into XML nodes. |
| 3 | ########################################################### |
| 4 | _audio_param_parser_FO_list := \ |
| 5 | MTK_WB_SPEECH_SUPPORT \ |
| 6 | MTK_AUDIO_HD_REC_SUPPORT \ |
| 7 | MTK_DUAL_MIC_SUPPORT \ |
| 8 | MTK_HANDSFREE_DMNR_SUPPORT \ |
| 9 | DMNR_TUNNING_AT_MODEMSIDE \ |
| 10 | MTK_VOIP_ENHANCEMENT_SUPPORT \ |
| 11 | MTK_TB_WIFI_3G_MODE \ |
| 12 | MTK_DISABLE_EARPIECE \ |
| 13 | MTK_ASR_SUPPORT \ |
| 14 | MTK_VOIP_NORMAL_DMNR \ |
| 15 | MTK_VOIP_HANDSFREE_DMNR \ |
| 16 | MTK_INCALL_NORMAL_DMNR \ |
| 17 | MTK_VOICE_UNLOCK_SUPPORT \ |
| 18 | MTK_VOICE_UI_SUPPORT \ |
| 19 | MTK_ACF_AUTO_GEN_SUPPORT \ |
| 20 | MTK_SPEAKER_MONITOR_SUPPORT \ |
| 21 | MTK_AUDIO_BLOUD_CUSTOMPARAMETER_REV \ |
| 22 | MTK_MAGICONFERENCE_SUPPORT \ |
| 23 | MTK_HAC_SUPPORT \ |
| 24 | MTK_AUDIO_SPH_LPBK_PARAM \ |
| 25 | MTK_AUDIO_GAIN_TABLE_BT \ |
| 26 | MTK_AUDIO_BT_NREC_WO_ENH_MODE \ |
| 27 | MTK_AUDIO_TUNING_TOOL_V2_PHASE \ |
| 28 | MATV_AUDIO_SUPPORT \ |
| 29 | MTK_FM_SUPPORT \ |
| 30 | MTK_HEADSET_ACTIVE_NOISE_CANCELLATION \ |
| 31 | MTK_SUPPORT_TC1_TUNNING \ |
| 32 | MTK_AUDIO_SPEAKER_PATH \ |
| 33 | MTK_AUDIO_NUMBER_OF_MIC \ |
| 34 | MTK_PLATFORM \ |
| 35 | MTK_AURISYS_FRAMEWORK_SUPPORT \ |
| 36 | MTK_BESLOUDNESS_RUN_WITH_HAL \ |
| 37 | MTK_AUDIO \ |
| 38 | USE_CUSTOM_AUDIO_POLICY \ |
| 39 | USE_XML_AUDIO_POLICY_CONF \ |
| 40 | MTK_AUDIO_TUNING_TOOL_VERSION \ |
| 41 | MTK_AUDIO_TUNNELING_SUPPORT \ |
| 42 | MTK_SMARTPA_DUMMY_LIB \ |
| 43 | MTK_HIFIAUDIO_SUPPORT \ |
| 44 | MTK_BESLOUDNESS_SUPPORT \ |
| 45 | MTK_USB_PHONECALL \ |
| 46 | MTK_AUDIO_NUMBER_OF_SPEAKER \ |
| 47 | MTK_A2DP_OFFLOAD_SUPPORT |
| 48 | |
| 49 | ########################################################### |
| 50 | ## Complex option customization are defined here. |
| 51 | ## |
| 52 | ## Prefix temporary variables with "_aupapa_" to prevent |
| 53 | ## the temporary variable from messing up global namespace. |
| 54 | ## The string will be stripped while assembling the XML. |
| 55 | ## |
| 56 | ## Finally add the variable to _audio_param_parser_FO_list. |
| 57 | ########################################################### |
| 58 | # MTK_WIFI_ONLY_SUPPORT |
| 59 | ifeq ($(MTK_TB_WIFI_3G_MODE),WIFI_ONLY) |
| 60 | _aupapa_VIR_WIFI_ONLY_SUPPORT := yes |
| 61 | else |
| 62 | _aupapa_VIR_WIFI_ONLY_SUPPORT := no |
| 63 | endif |
| 64 | _audio_param_parser_FO_list += _aupapa_VIR_WIFI_ONLY_SUPPORT |
| 65 | |
| 66 | # MTK_3G_DATA_ONLY_SUPPORT |
| 67 | ifneq ($(filter 3GDATA_SMS 3GDATA_ONLY,$(MTK_TB_WIFI_3G_MODE)),) |
| 68 | _aupapa_VIR_3G_DATA_ONLY_SUPPORT := yes |
| 69 | else |
| 70 | _aupapa_VIR_3G_DATA_ONLY_SUPPORT := no |
| 71 | endif |
| 72 | _audio_param_parser_FO_list += _aupapa_VIR_3G_DATA_ONLY_SUPPORT |
| 73 | |
| 74 | # SUPPORT_ASR |
| 75 | ifeq ($(MTK_ASR_SUPPORT),yes) |
| 76 | ifeq ($(MTK_DUAL_MIC_SUPPORT),yes) |
| 77 | _aupapa_VIR_ASR_SUPPORT := yes |
| 78 | else |
| 79 | _aupapa_VIR_ASR_SUPPORT := no |
| 80 | endif |
| 81 | else |
| 82 | _aupapa_VIR_ASR_SUPPORT:=no |
| 83 | endif |
| 84 | _audio_param_parser_FO_list += _aupapa_VIR_ASR_SUPPORT |
| 85 | |
| 86 | # SUPPORT_VOIP_NORMAL_DMNR |
| 87 | ifneq ($(MTK_DISABLE_EARPIECE),yes) |
| 88 | ifeq ($(MTK_DUAL_MIC_SUPPORT),yes) |
| 89 | ifeq ($(MTK_VOIP_NORMAL_DMNR),yes) |
| 90 | ifeq ($(MTK_VOIP_ENHANCEMENT_SUPPORT),yes) |
| 91 | _aupapa_VIR_VOIP_NORMAL_DMNR_SUPPORT := yes |
| 92 | else |
| 93 | _aupapa_VIR_VOIP_NORMAL_DMNR_SUPPORT := no |
| 94 | endif |
| 95 | else |
| 96 | _aupapa_VIR_VOIP_NORMAL_DMNR_SUPPORT := no |
| 97 | endif |
| 98 | else |
| 99 | _aupapa_VIR_VOIP_NORMAL_DMNR_SUPPORT := no |
| 100 | endif |
| 101 | else |
| 102 | _aupapa_VIR_VOIP_NORMAL_DMNR_SUPPORT := no |
| 103 | endif |
| 104 | _audio_param_parser_FO_list += _aupapa_VIR_VOIP_NORMAL_DMNR_SUPPORT |
| 105 | |
| 106 | # SUPPORT_VOIP_HANDSFREE_DMNR |
| 107 | ifeq ($(MTK_DUAL_MIC_SUPPORT),yes) |
| 108 | ifeq ($(MTK_VOIP_HANDSFREE_DMNR),yes) |
| 109 | ifeq ($(MTK_VOIP_ENHANCEMENT_SUPPORT),yes) |
| 110 | _aupapa_VIR_VOIP_HANDSFREE_DMNR_SUPPORT := yes |
| 111 | else |
| 112 | _aupapa_VIR_VOIP_HANDSFREE_DMNR_SUPPORT := no |
| 113 | endif |
| 114 | else |
| 115 | _aupapa_VIR_VOIP_HANDSFREE_DMNR_SUPPORT := no |
| 116 | endif |
| 117 | else |
| 118 | _aupapa_VIR_VOIP_HANDSFREE_DMNR_SUPPORT := no |
| 119 | endif |
| 120 | _audio_param_parser_FO_list += _aupapa_VIR_VOIP_HANDSFREE_DMNR_SUPPORT |
| 121 | |
| 122 | # NO_SPEECH |
| 123 | _aupapa_VIR_NO_SPEECH := no |
| 124 | ifeq ($(_aupapa_VIR_WIFI_ONLY_SUPPORT),yes) |
| 125 | _aupapa_VIR_NO_SPEECH := yes |
| 126 | endif |
| 127 | ifeq ($(_aupapa_VIR_3G_DATA_ONLY_SUPPORT),yes) |
| 128 | _aupapa_VIR_NO_SPEECH := yes |
| 129 | endif |
| 130 | _audio_param_parser_FO_list += _aupapa_VIR_NO_SPEECH |
| 131 | |
| 132 | # SUPPORT_INCALL_NORMAL_DMNR |
| 133 | ifneq ($(MTK_DISABLE_EARPIECE),yes) |
| 134 | ifneq ($(_aupapa_VIR_NO_SPEECH),yes) |
| 135 | ifeq ($(MTK_DUAL_MIC_SUPPORT),yes) |
| 136 | ifneq ($(MTK_INCALL_NORMAL_DMNR),no) |
| 137 | _aupapa_VIR_INCALL_NORMAL_DMNR_SUPPORT := yes |
| 138 | else |
| 139 | _aupapa_VIR_INCALL_NORMAL_DMNR_SUPPORT := no |
| 140 | endif |
| 141 | else |
| 142 | _aupapa_VIR_INCALL_NORMAL_DMNR_SUPPORT := no |
| 143 | endif |
| 144 | else |
| 145 | _aupapa_VIR_INCALL_NORMAL_DMNR_SUPPORT := no |
| 146 | endif |
| 147 | else |
| 148 | _aupapa_VIR_INCALL_NORMAL_DMNR_SUPPORT := no |
| 149 | endif |
| 150 | _audio_param_parser_FO_list += _aupapa_VIR_INCALL_NORMAL_DMNR_SUPPORT |
| 151 | |
| 152 | # SUPPORT_INCALL_HANDSFREE_DMNR |
| 153 | ifneq ($(_aupapa_VIR_NO_SPEECH),yes) |
| 154 | ifeq ($(MTK_DUAL_MIC_SUPPORT),yes) |
| 155 | ifeq ($(MTK_INCALL_HANDSFREE_DMNR),yes) |
| 156 | _aupapa_VIR_INCALL_HANDSFREE_DMNR_SUPPORT := yes |
| 157 | else |
| 158 | _aupapa_VIR_INCALL_HANDSFREE_DMNR_SUPPORT := no |
| 159 | endif |
| 160 | else |
| 161 | _aupapa_VIR_INCALL_HANDSFREE_DMNR_SUPPORT := no |
| 162 | endif |
| 163 | else |
| 164 | _aupapa_VIR_INCALL_HANDSFREE_DMNR_SUPPORT := no |
| 165 | endif |
| 166 | _audio_param_parser_FO_list += _aupapa_VIR_INCALL_HANDSFREE_DMNR_SUPPORT |
| 167 | |
| 168 | # SUPPORT_VOICE_UNLOCK |
| 169 | ifeq ($(MTK_VOICE_UNLOCK_SUPPORT),yes) |
| 170 | _aupapa_VIR_VOICE_UNLOCK_SUPPORT := yes |
| 171 | endif |
| 172 | ifeq ($(MTK_VOICE_UI_SUPPORT),yes) |
| 173 | _aupapa_VIR_VOICE_UNLOCK_SUPPORT := yes |
| 174 | endif |
| 175 | _audio_param_parser_FO_list += VIR_VOICE_UNLOCK_SUPPORT |
| 176 | |
| 177 | # VIR_AUDIO_BLOUD_CUSTOMPARAMETER_V5 |
| 178 | _aupapa_VIR_AUDIO_BLOUD_CUSTOMPARAMETER_V5 := yes |
| 179 | _audio_param_parser_FO_list += _aupapa_VIR_AUDIO_BLOUD_CUSTOMPARAMETER_V5 |
| 180 | |
| 181 | # VIR_AUDIO_BLOUD_CUSTOMPARAMETER_V4 |
| 182 | _aupapa_VIR_AUDIO_BLOUD_CUSTOMPARAMETER_V4 := no |
| 183 | _audio_param_parser_FO_list += _aupapa_VIR_AUDIO_BLOUD_CUSTOMPARAMETER_V4 |
| 184 | |
| 185 | # SUPPORT_MAGI_CONFERENCE |
| 186 | ifeq ($(MTK_MAGICONFERENCE_SUPPORT),yes) |
| 187 | ifeq ($(MTK_DUAL_MIC_SUPPORT),yes) |
| 188 | _aupapa_VIR_MAGI_CONFERENCE_SUPPORT := yes |
| 189 | else |
| 190 | _aupapa_VIR_MAGI_CONFERENCE_SUPPORT := no |
| 191 | endif |
| 192 | else |
| 193 | _aupapa_VIR_MAGI_CONFERENCE_SUPPORT := no |
| 194 | endif |
| 195 | _audio_param_parser_FO_list += _aupapa_VIR_MAGI_CONFERENCE_SUPPORT |
| 196 | |
| 197 | # SUPPORT_AUDIO_LAYERED_PARAM |
| 198 | ifneq ($(MTK_AUDIO_TUNING_TOOL_VERSION),) |
| 199 | ifneq ($(strip $(MTK_AUDIO_TUNING_TOOL_VERSION)),V1) |
| 200 | _aupapa_MTK_AUDIO_TUNING_TOOL_V2_PHASE := \ |
| 201 | $(shell echo $(MTK_AUDIO_TUNING_TOOL_VERSION) | sed 's/V2\.//g') |
| 202 | _aupapa_MTK_AUDIO_HIERARCHICAL_PARAM_SUPPORT := yes |
| 203 | endif |
| 204 | endif |
| 205 | _audio_param_parser_FO_list += _aupapa_MTK_AUDIO_HIERARCHICAL_PARAM_SUPPORT |
| 206 | _audio_param_parser_FO_list += _aupapa_MTK_AUDIO_TUNING_TOOL_V2_PHASE |
| 207 | |
| 208 | # VIR_MTK_XXXX_IIR_ENH_SUPPORT & VIR_MTK_VOIP_IIR_MIC_SUPPORT |
| 209 | ifeq ($(MTK_AURISYS_FRAMEWORK_SUPPORT),yes) |
| 210 | _aupapa_VIR_MTK_RECORD_IIR_ENH_SUPPORT := yes |
| 211 | _aupapa_VIR_MTK_VOIP_IIR_ENH_SUPPORT := yes |
| 212 | _aupapa_VIR_MTK_VOIP_IIR_MIC_SUPPORT := yes |
| 213 | else |
| 214 | _aupapa_VIR_MTK_RECORD_IIR_ENH_SUPPORT := no |
| 215 | _aupapa_VIR_MTK_VOIP_IIR_ENH_SUPPORT := no |
| 216 | _aupapa_VIR_MTK_VOIP_IIR_MIC_SUPPORT := no |
| 217 | endif |
| 218 | _audio_param_parser_FO_list += _aupapa_VIR_MTK_RECORD_IIR_ENH_SUPPORT |
| 219 | _audio_param_parser_FO_list += _aupapa_VIR_MTK_VOIP_IIR_ENH_SUPPORT |
| 220 | _audio_param_parser_FO_list += _aupapa_VIR_MTK_VOIP_IIR_MIC_SUPPORT |
| 221 | |
| 222 | ########################################################### |
| 223 | ## Remove AUDIO_PARAM_OPTIONS_LIST duplicated item (keep first decleration) |
| 224 | ########################################################### |
| 225 | |
| 226 | $(foreach n,$(AUDIO_PARAM_OPTIONS_LIST),\ |
| 227 | $(eval KEY := $(firstword $(subst =, ,$(n))))\ |
| 228 | $(eval $(if $(filter $(KEY)=%,$(NEW_AUDIO_PARAM_OPTIONS_LIST)),$(info Ignore duplicated AUDIO_PARAM_OPTION: $(n)),NEW_AUDIO_PARAM_OPTIONS_LIST += $(n)))\ |
| 229 | ) |
| 230 | AUDIO_PARAM_OPTIONS_LIST := $(NEW_AUDIO_PARAM_OPTIONS_LIST) |
| 231 | |
| 232 | ########################################################### |
| 233 | ## Target definition |
| 234 | ########################################################### |
| 235 | AUDIOPARAM_XML_INSTALLED := $(TARGET_OUT_VENDOR_ETC)/audio_param/AudioParamOptions.xml |
| 236 | AUDIOPARAM_XML_DEPS := \ |
| 237 | $(LOCAL_PATH)/Android.mk \ |
| 238 | $(lastword $(MAKEFILE_LIST)) |
| 239 | |
| 240 | $(AUDIOPARAM_XML_INSTALLED): $(AUDIOPARAM_XML_DEPS) |
| 241 | @mkdir -p $(dir $@) |
| 242 | @echo '<?xml version="1.0" encoding="UTF-8"?>' >$@ |
| 243 | @echo '<AudioParamOptions>' >>$@ |
| 244 | @$(foreach i,$(_audio_param_parser_FO_list),echo ' <Param name="$(patsubst _aupapa_%,%,$(strip $(i)))" value="$(strip $($(i)))" />' >>$@;) |
| 245 | @$(foreach i,$(AUDIO_PARAM_OPTIONS_LIST),echo ' <Param name="$(firstword $(subst =, ,$(i)))" value="$(word 2,$(subst =, ,$(i)))" />' >>$@;) |
| 246 | @echo '</AudioParamOptions>' >>$@ |
| 247 | |
| 248 | ALL_DEFAULT_INSTALLED_MODULES += $(AUDIOPARAM_XML_INSTALLED) |
| 249 | $(LOCAL_BUILT_MODULE):$(AUDIOPARAM_XML_INSTALLED) |