[Xposed] [EXPERIMENTAL] National Roaming
Do you need to enable data roaming to get a connection even in your home network? If so, you probably know the hassle this causes when you travel abroad, or live near the border where your phone can sometimes log into another network. You have to disable data roaming every time, and if you forget, you'll get an unpleasant surprise on your next phone bill.
Maybe you know CyanogenMod's "National Roaming" feature that enables roaming only in your home country, so you don't have to disable roaming manually when you leave the country. I've used this in the past and got used to it, so much that having to live without it would annoy me a lot.
Since I just got a new phone for which CyanogenMod isn't available, I wrote an Xposed module which mimics this feature. My new phone happens to be an MTK6589 dual SIM device (Tronsmart TS7), so I also added support for the dual SIM modifications MediaTek made.
It's in a very early stage and mostly untested. It "works" insofar as the roaming icon is gone and I get a data connection without enabling roaming. I don't know if it properly detects when you're really roaming. It should, but I can't test it for now since I don't live near the border and don't have a working foreign SIM. If somebody could test whether it actually works, that would be greatly appreciated!
It *should* work on any Android version Xposed runs on, but so far I've only tested it on my TS7's stock 4.2.1.
I intend to publish it there as well, but only after it has been a bit more thoroughly tested and enough people reported that it works and doesn't cause any issues.
(old versions here
v0.2 - 2013-08-29 - fix Android 4.3 compatibility
v0.1 - 2013-08-25 - initial release
The module works by hooking pollStateDone()
in com.android.internal.telephony.gsm.GsmServiceState Tracker
. This function notifies listeners when the roaming state changes. So to fake the roaming state everything else sees, we only have to change it before this function is called. The logic is simple: We're roaming if and only if the MCC (mobile country code - first three digits of the numeric operator id) stored on the SIM and provided by the network differ.
In the past, I've manually patched framework.jar for some ROMs for my device and some others, by modifying isRoamingBetweenOperators()
* to follow the same logic as this module. With Xposed available now, writing this as a module seems like a much cleaner solution that will work on many more devices than one could reasonably maintain manually, and with much less effort.
* I initially tried to hook this function with Xposed. However, this didn't work, because while the function exists in MediaTek's stock ROM, it never seems to be called.