I've been investigating on this topic specific to MSM8960 for some time. I looked into the ALSA hardware module from google. Michael's answer in the post did mention that MSM8960 supported the in-call uplink audio injection at "Hardware and Device Driver" level. Did it refer to the level at this ALSA module?
From the ALSA config file on the phone, it seems the in call voice playback is done through /dev/snd/pcmC0D0p
, or at least comply with the ALSA paradigm. Is it possible to play with one of the file descriptor to achieve the purpose? I do see some interesting USE_CASE definition in libalsa-intf.
The MSM8960 provides an ALSA control named Incall_Music Audio Mixer
, to which you can connect CPU DAIs MultiMedia1
and MultiMedia2
(which would correspond to ALSA devices pcmC0D0p
and pcmC0D1p
, respectively). (see the msm-pcm-routing source code)
So if you had a voice call running and wanted to play some audio on the uplink through pcmC0D0p
you could do this through adb shell
(assuming that you've got root access):
amix 'Incall_Music Audio Mixer MultiMedia1' 1
aplay -Dhw:0,0 mono_8khz_audio.wav
The more elegant way would be to create a new use-case in the device's UCM file (snd_soc_msm_blah_blah..) where you add the incall music routing in the enable-sequence of your new modifer:
'Incall_Music Audio Mixer MultiMedia1':1:1
(remember to turn it off in the disable-sequence).
For apps to be able to use this functionality on your custom ROM you'd also have to make some other changes in the audio HAL and multimedia framework, so that your new UCM setting is selected for the desired stream types when a call is active.
Due to copyright reasons I can't go into any detail about the rest of the implementation, so I'll leave it as an exercise for those interested to figure it out for themselves.