Where can I find the list of networks considered not roaming?


Question

Some time ago, back in the days of CyanogenMod, I stumbled across a list of network combinations which were not considered roaming.


Usually, Android looks at the MCC and MNC of the SIM card and compares them to those of the current network. If they do not match, Android considers itself to be roaming. The status bar icon will report this, and options such as disabling data while roaming take effect.


The list overrides this behavior by specifying combinations of MCC/MNC pairs which are not considered roaming. For example, O2 Germany (262-07) acquired rival E-Plus (262-03) a few years back. Initially, cell towers still used the MCC/MNC of the original operator, but customers could roam between both networks at no extra charge. For cases like these, the list would have had a rule like “if the SIM card has 262-07, consider network 262-03 to be the home network, not a roaming network” (and another one for the opposite case of an E-Plus card being used on an O2 tower).


This list sits somewhere in the source code and is not exposed through settings. Unfortunately, I do not know where to find it (and if it ever was part of AOSP, or added by Cyanogenmod).


Does anyone know where this list is located?


Answer

The decision if a SIM is connected to a roaming network (a network of another country, for example) is done by the framework with the information obtained on this network.
First, we need to know that there are two types:



  • Domestic Roaming -> A network of the same country (same MCC) as the SIM but that it is of other operator (different MNC).

  • International Roaming -> A network of another country (different MCC)


A lot of OEMs (BQ, Samsung, Xiaomi...) treat Domestic Roaming as not roaming because, for example, all the MVNO use Domestic Roaming.


By default, AOSP has a way to add networks so they will always be considered roaming (as well as adding networks that will never be considered roaming)


For AOSP, it works like this:




In ServiceStateTracker.java of framework/opt/telephony:


/**
* Do not set roaming state in case of oprators considered non-roaming.
*
* Can use mcc or mcc+mnc as item of
* { @link CarrierConfigManager#KEY_NON_ROAMING_OPERATOR_STRING_ARRAY } .
* For example, 302 or 21407. If mcc or mcc+mnc match with operator,
* don't set roaming state.
*
* @param s ServiceState hold current ons
* @return false for roaming state set
*/
private boolean isOperatorConsideredNonRoaming(ServiceState s) {
String operatorNumeric = s.getOperatorNumeric();
PersistableBundle config = getCarrierConfig();
String[] numericArray = config.getStringArray(
CarrierConfigManager.KEY_NON_ROAMING_OPERATOR_STRING_ARRAY);
if (ArrayUtils.isEmpty(numericArray) || operatorNumeric == null) {
return false;
}
for (String numeric : numericArray) {
if (!TextUtils.isEmpty(numeric) && operatorNumeric.startsWith(numeric)) {
return true;
}
}
return false;
}

and at the same way:


private boolean isOperatorConsideredRoaming(ServiceState s) {

String operatorNumeric = s.getOperatorNumeric();
PersistableBundle config = getCarrierConfig();
String[] numericArray = config.getStringArray(
CarrierConfigManager.KEY_ROAMING_OPERATOR_STRING_ARRAY);
if (ArrayUtils.isEmpty(numericArray) || operatorNumeric == null) {
return false;
}
for (String numeric : numericArray) {
if (!TextUtils.isEmpty(numeric) && operatorNumeric.startsWith(numeric)) {
return true;
}
}
return false;
}

If we search information about KEY_ROAMING_OPERATOR_STRING_ARRAY and KEY_NON_ROAMING_OPERATOR_STRING_ARRAY in Android Developers we found that
enter image description here


So you could add in carrier_config_21407 (Movistar Spain) a list of roaming and not roaming list:


<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<carrier_config_list>
<carrier_config>
<string-array name="gsm_nonroaming_networks_string_array" num="1">
<item value="26804" /> //for example, LycaMobile Portugal
</string-array>
</carrier_config>
</carrier_config_list>

The carrier config files are found in platform/packages/apps/CarrierConfig. There are two possible formats:



Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes