anton-arnold / xoverrideheadphonejackdetection

XPosed module that allows overriding headphone detection status in android devices
GNU General Public License v3.0
22 stars 1 forks source link

Could it be used to force switch to secondary mic? #9

Closed Ptrph closed 2 years ago

Ptrph commented 3 years ago

Hello, I have a Moto G7 plus. The microphone used during calls (on the bottom on the phone) does not work at all. But if I plug a headphone or if I activate the speaker during the call, the phone switch to a secondary microphone (above the phone) and it works.

I was wondering if one setting of your app could switch the microphone selection to the secondary one during calls, without headphones plugged in and without activating the speakers. That would be nice for my situation! I’ve tried some settings but I can’t really figure out if it’s possible.

Is it possible? Do I miss something?

Thanks!

anton-arnold commented 2 years ago

@Ptrph Hi, I think this is not possible within the scope of this module. If you are willing to spend some time into this issue, you can probably build your own android image with adjusted sound routing.

https://github.com/PixelExperience-Devices/device_motorola_lake/tree/eleven/audio https://github.com/PixelExperience-Devices/device_motorola_lake/blob/c54ec1386f60f0d87106b0fc4e1dd6931f03dd60/audio/audio_platform_info.xml#L22 https://github.com/PixelExperience-Devices/device_motorola_lake/blob/c54ec1386f60f0d87106b0fc4e1dd6931f03dd60/audio/audio_policy_configuration.xml#L101

Otherwise you might try this compromise solution: https://android.stackexchange.com/questions/185825/how-can-you-change-which-microphone-is-used-during-calls

Ptrph commented 2 years ago

Thanks a lot for your reply! Following the different links and info, I found a way to reroute the mic by editing the mixer_paths.xml file (one of those that you linked). I don’t have the skills to build an android image, but I’ve installed LineageOS with Magisk and created a Magisk module that replaces the original mixer_paths.xml. (It could probably work with Magisk and the original ROM, I don’t know.)

I probably spent too much time on this (trying to modify the paths and devices in the audio files…), but I’ve learned some things on the way…

I don’t know if it can help somebody some day but I’ve replaced this

    <path name="handset-mic">
        <path name="AOV" />
        <ctl name="SLIMTX1 Input 1" value="ISRC2DEC1" />
        <ctl name="IN1L Volume" value="12" />
    </path>

with this:

    <path name="handset-mic">
        <path name="mic2" />
    </path>

(It’s device-specific.)

Now the phone doesn’t use the broken mic in calls. It’s not optimal but it works.

Sorry for the off-topic issue and thanks a lot again for your reply!