vendor/mediatek/proprietary/hardware/audio/common/V3/aud_drv/AudioALSAHardware.cpp
source code
if (param.getInt(keySET_MIC_CHOOSE, value) ==NO_ERROR) {
param.remove(keySET_MIC_CHOOSE);
ALOGD("+%s(): %s", __FUNCTION__,"setBuiltInMicSpecificType");
if(value==2){
AudioALSAHardwareResourceManager::getInstance()->setBuiltInMicSpecificType(BUILTIN_MIC_MIC2_ONLY);
}else if(value==1){
AudioALSAHardwareResourceManager::getInstance()->setBuiltInMicSpecificType(BUILTIN_MIC_MIC1_ONLY);
}else{
AudioALSAHardwareResourceManager::getInstance()->setBuiltInMicSpecificType(BUILTIN_MIC_DEFAULT);
}
}
Change this else to mic2, which is the top microphone
AudioALSAHardwareResourceManager::getInstance()->setBuiltInMicSpecificType(BUILTIN_MIC_MIC2_ONLY);
Then wherever you can receive the boot broadcast or in finshbooting in the AcitivityManagerService just after boot, set the value to 0 and let it go to else:
For example ./override/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/mediatek/settings/network/RoamingSettingsReceiver.java
Static broadcast acceptance. This has the action of receiving the boot broadcast
join in
import android.media.AudioManager;
AudioManager mAudioManager = (AudioManager) sContext.getSystemService(Context.AUDIO_SERVICE);
mAudioManager.setParameters("ForceUseSpecificMic=0");
The string written by this parameter, why use this,
in AudioALSAHardware.cpp
here is
if(param.getInt(keySET_MIC_CHOOSE, value) == NO_ERROR) {
This defines
//Dual Mic use only one mic
static String8 keySET_MIC_CHOOSE =String8("ForceUseSpecificMic");