[AT&T Samsung Galaxy Note II] madmack:
Good point. I'll see if I can run the cm secril on stock.

For the RILJ stuff, unfortunately I did try Smdk4210RIL and that didn't work either. I also tried the QualcommUicc one and QualcommShared which the D2 one extends. QualcommUicc is used on the note 1 lte.

1. Smdk4210RIL: unable to connect to rild socket iirc.

2. QualcommShared: connect fine. Phone app hangs when placing call.

3. QualcommUicc: phone call goes through, however, the Phone app hangs when trying to hang up.

4. D2RIL: Phone behavior works fine. Dialog between RILC and RILJ seems healthy. I haven't seen anything odd in the radio logs and the behavior is very similar to what i see on stock. In stock, RILJ doesn't respond to UNSOL info. The only bit where we're different is with all of these OEM HOOK requests/replies. I don't think that's the issue though given that these are some proprietary codes going back and forth between RILJ and RILC when the phone boots up and then they stop. We're actually lucky to have a pretty verbose RILD. It does spell out a ton of info.

What else did I try:

1. Moving bits from the i317 kernel into the smdk cm kernel. Eventually, I moved the entire mach-exynos and the sound soc files over. Diffing the two kernels, I saw that they only differed in the video subfolders so I left that alone.

2. Added more CONFs to the defconfig to better match the i317 default defconfig. I enabled one that I thought was the culprit: MACH_T0_USA_ATT because it does set some stuff different in t0_sound.c file. That didn't fix it either.

3. As I said before, I removed the entire lib/hw part of the ROM and introduced the binaries from stock and all their dependencies. That also meant letting go of the tinyalsa open source library. After putting the stock tiny alsa, the rom asked for audio confs from stock (tinyucm and audio_config). Good! why? At least I know for certain that routing isn't the issue here.

4. I reverted back to open source audio.primary.smdk4x12 with more logging and verbosity. Apparently the linked function: ril_open is returning a normal value (open success) and verifying that the ril socket is open afterwards (with ril_is_connected) returned that it indeed is.

This is driving me crazy. But I'm learning a ton with every attempt. I also admire the work cody done for the RILJ and the open source audio.primary library. Debugging that stuff must've been a b***. D2RIL actually overwrites one function with the stuff in SmdkRIL keeping the rest all Qualcomm.

Could I have messed up a permission or a socket initiation in the ramfs? I doubt it but it'll be worth looking into that again.

I've also been staring at logcats of main/system and radio to see if there are any differences. Apparently samsung put a load of proprietary stuff even in the MediaService.java file (framework.jar) which does some crap like connect to rild with setParameters(ril_connected=1) wheenver it gets notified that the radio is connected.

Now here is the strange part. I've worked on porting TW roms from N7100 to I317 & N7105 (See here). The files that differ are already moved to my build and I still hear nada and cannot be heard either. When I moved in binaries from the N7100 -> I317. Initially, everything worked except rild audio. I was able to fix that by moving in libaudio-ril.so and any library that required it (audio.primary.smdk4120.so) along with their dependencies. That fixed it there.

So I'm thinking this problem is either still in the kenrel (or ramfs.. I would be mad if the ramfs is the culprit !) or a nasty trick that samsung is employing in the framework to somehow activate the socket once a connection to a tower is established.

After all, you do get crap like that in stock:

E/AudioService( 2406): ##################################################
E/AudioService( 2406): ### RIL State is changed
E/AudioService( 2406): ##################################################
I/AudioHardwareTinyALSA( 1974): setParameters(ril_connected=1)
I/AudioHardwareTinyALSA( 1974): connect RILD ok
I/audio_wfd_hw( 1974): adev_set_parameters() ril_connected=1

AudioService here is in framework.jar. I actually even went as far as setting that parameter explicitly (through hacking AudioService.java to set that parameter wheneve the screen is off). Now, I get the same crap from tinyalsa that "connect RILD ok". But we still have no audio in phone calls. Note the code segment above does not happen in aosp. It's like audioservice is notified by rild and it acts on that.

Now I'll put life back into my note 2 by flashing TW back and see if libsecril-audio works. (edit: it does).