Hi All,
I'm using sabresd board with imx6 Android7.1.2 platform. I'm trying play some audio with command, I'm able to hear on headset and HDMI is not connected on this time. If i connect HDMI i'm not able hear on headset jack.
I think audio routing to HDMI interface.
I want audio output always on Headset jack. How can resolve this issue??
Regards,
Aravinth
Hi,
i found the solution for this, we can choose the output in our android source code.
In default, android will route audio into HDMI, to choose route into speaker:
AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
audioManager .setMode(AudioManager.MODE_IN_COMMUNICATION);
audioManager.setSpeakerphoneOn(true);
To choose route to HDMI again, set mode to normal:
audioManager.setMode(AudioManager.MODE_NORMAL);
Regards,
Hi Nguyen
Can you give the exact file name and location in android source code.
Can you please attach the modified file also.!
Regards,
Aravinth
Hi Aravinth,
this code does not implement in AOSP, you have to write it in your own android application.
OR you can write one android service run in background, it listens HDMI plugged and then set route audio to speaker automatically.
Regards,
Hello Nguyen,
Is there any way to integrate these changes to the default Android source code, so that audio output is only on headphone irrespective of a HDMI connected to the board neither writing an app nor a background service. If there is a way for implementing this, kindly let me know!!
Regards,
Deexith
Hi Deexith,
In Android 7, i can overlay audio_policy_configuration to change the default audio route path from speaker -> headphone.
Please try to change 'defaultOutputDevice' in file: audio_policy_configurations.xml
Regards,
Hello @Nguyen,
My first approach was same as ur'z!! Since default wm8524-codec configuration file din't have a digital aux support, audio was not routing to headphone. I solved this by adding a digital aux support in wm8524-codec configuration file inside alsa.
Regards,
Deexith V
Hi Deexith,
In Android HAL you can do the modification, to set audio output as headphone all the time.
Regards,
Aravinth
Hello aravinthkumarjayaprakasam,
Can you please be more specific on this, i mean which file to look into and what exactly are the changes.
Regards,
Deexith
Can you please share more details about your hardware, Audio module, Android version,etc.
Regards,
Aravinth
I am porting Android 8.1.0 on i.MX8M EVK which has WM8524 codec support
Regards,
Deexith
Hi Deexith,
Audio path selection will happen on below code.
hardware/imx/alsa/tinyalsa_hal.c
You select which output stream you want.
Regards,
Aravinth
I have the same problem on imx6 android 6.0.1. It routes audio to HDMI when plugged. Don't know where to config output.
You can choose the output with alsamixer.
Have a great day,
Victor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi @Victor Linnik,
Is there any update on this.?
Regards,
Aravinth
Hi Victor,
Thanks for the response. I have checked and tinyalsa layer. But i didn't get what exactly i have to change.
Have give me more about and exact information about it.
Thanks
Aravinth!