Ujanja Ni Uhai (Hustling Is Life)

SIM Toolkit working on Samsung + CyanogenMod

Last year I posted a confused rant about SIM Toolkit being broken on CyanogenMod 7 on the Samsung Galaxy S. I’ve since learned more about the issue and come to realize it wasn’t Google or CyanogenMod’s fault: it was Samsung’s. Vanilla Android itself supports SIM Toolkit, and Samsung’s stock ROMs support it, so what gives?

Basically, Samsung’s radio hardware and RIL send different responses to the Android OS than the stock RIL and SIM Toolkit applications are set to deal with. Recently a patch was merged into CyanogenMod which adds functionality to understand this Samsung-specific RIL behavior. I’ve tested it on my Exynos4-based Samsung Galaxy Tab 7 Plus, and others have tested it on the Galaxy S2 and Galaxy S3. It should probably work on the original Galaxy S, but I don’t have mine anymore so I can’t test.

It works!

Anyways, this is great news for people who love CyanogenMod and live in countries like Kenya where the use of SIM Toolkit is widespread (and really fucking useful). Adios, TouchWiz. 😉

Yes, the link I provided was for developers. The fact that CyanogenMod merged it means that you don’t have to use a patch, you just need to update to a new version of CyanogenMod (CyanogenMod 9 actually, the patch wasn’t merged in CM7).

hey there alan… in looking into this more it sounds like the original problem and the CM9 patch is specific samsung devices… does that mean that CM7 may work with SIM toolkit on other devices?

You mentioned on that post that SIM toolkit doesn’t work with huawei u8150, but just noticed sambaza at least seems to work. do you know more about the u8150 issues with SIM toolkit? what can/can’t you do? thanks! -louis

SIM Toolkit works on the U8150 just fine under CyanogenMod. Did I say it didn’t? As far as I know it’s only Samsung devices which have a problem with it on AOSP-based ROMs. 🙂 Functions unimplemented in the radio interface layer, which Samsung adds to their ROMs. Proprietary. Blah blah blah. 🙂

I can confirm that as of now (13/10/2012) that this problem is back on the Galaxy s3. All current Jelly Bean Roms (SuperNexus etc) that ship with the STK (sim toolkit) that I have tested have this issue.

Guess I just have to stick to ICS until Samsung relase their 4.1 version or CM9 for the SIII is released.

I’m not surprised at all, haha. As I understand it, Samsung’s modems send the Stk data in a format which AOSP’s RIL doesn’t understand. It won’t work in any AOSP-based ROMs (like CyanogenMod) until this patch is ported to CM10: http://review.cyanogenmod.com/#/c/18298/

Hmmm, that’s peculiar. I wonder what they’re actually doing. That link says it’s based on a “latest firmware”, which means he’s repackaged a Samsung firmware (unzip, remove APKs, change PNG files, etc, and then repack). Are you sure it’s Jellybean?

The other option is that it’s actually a CyanogenMod 10 beta in disguise, and that the RIL on CM10 works fine with the Galaxy S III + SIM Toolkit. I dunno. But be wary of lame devs zip kanging ROMs on XDA.

I have a friend with a Galaxy Ace on Safaricom in Kenya and we’re trying to get M-PESA to work. The device has CM 7.2 which as you say doesn’t have the patch, there’s no stable CM9 ROM for the Ace yet, so is it possible to convert the code in the link you posted to some sort of APK or ClockWork Recovery ZIP to get CM 7.2 STK working on the Ace?

Nope. Not possible. The patch I linked to involves the Android base framework (actually the Radio Interface Layer, the part which translates messages from the modem to the OS), and that’s quite complicated. You can’t just convert the APK file. You just have to wait, man. Or backport the patch yourself 😉

Haha, good call. Yeah, the SIM Toolkit patch was initially ported to CM9. “Backporting” means making it work in an earlier version, ie CM7. It’s not a simple job, as those are two major revisions of Android, and LOTS of stuff has changed. That’s why you can’t just yank a working Stk.apk out of a CM9 build and stick it in your phone. It has to be patched at the source level and recompiled.

I downgraged to CM9-based AniDroid-N7000 custom ROM (I know you’ve mentioned sticking to official CM, but this one has Linaro optimizations, and I did check out Linaro and lots of people are full of praise for them with some websites and users saying they boost performance of stock android by even 100%) and that resolved the sim toolkit issue. To be frank even when I had CM10 I never really found it to be any better than CM9 including visually and performance wise, and it did look a lot more incomplete besides the SIM Toolkit issue. Now considering you say it has got a patch for the latter issue, is there a point in flashing it just yet or would you think CM9 should suffice for now?

Yes, CM10 is still in a state of flux. LOTS of patches still being merged, and new functionality being invented. CM9 is the stable choice for now, unless you’re addicted to ROM flashing, to which I’d recommend running nightly CM builds from http://get.cm 😛

Another follow up. Tried out MIUI and sim toolkit works on it ok. So if anyone is like me tired of waiting for stable Jelly Bean roms with sim toolkit working, you can try it out. Sure it’s a bit iphoneish, but… well sometimes it’s good to try new things. ICS though.

As someone who regularly tries out new roms I’ll say what Alan always says, stick to the major roms. I’ve almost bricked my phone a couple of times trying out roms on xda. I’ll stick to MIUI until CM9 or CM10 for the SIII is released and sim toolkit is working.

The Stk patch itself was merged into CM10, but each device’s maintainer has to actually specify that it wants to enable the use of the Samsung-specific Stk commands. Galaxy Note (N7000) hasn’t done this yet.

Btw i seen this patch is abandoned -because is already on cm10, but today i tryed both cm9.1 and cm10 last nightly builds and cm9.1 stable and still no sim toolkit on galaxy note. Just nothing at app drawer
And yea i used pure cm builds from get.cm – mb some galaxy note related troubles =(

Hi guys i am having the same problem as the users from Kenya , I have tried all the roms even the latest CM nightlies and the STK does not function exactly as expected , it displays some menu items but does not give feedback when digits are entered.

Talk to Samsung. It’s their modem hardware which is doing different things than AOSP’s Radio Interface Layer expects. For what it’s worth, STK works on CM10 on my Samsung Galaxy Tab 7 Plus, which is using the same exact RIL class as your phone.

These kinds of issues are unfortunately what we have to deal with when we install AOSP-based ROMs on our devices. I’ve decided I will only buy Nexus devices from now on, so I don’t have to “fight” against the hardware.

So i have TouchWhiz 9.0 i really do love this custom rom. i have galaxy ace 850i. well back to the issue at hand its okay but no stk. i put an airtel line it appers but it doesnt really function. so am finally going to back port it. Next stable ROM for the ace is RazerDroid well the apk works just fine but not as smart.