1

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?

3
  • 1
    An interesting question. Are you sure that the descicion if a network is considered as roaming or not is not made by the SIM card? From my knowledge this would be the point where I would expect such a functionality.
    – Robert
    Oct 25, 2020 at 19:43
  • Like Robert I'd rather expect it either with the SIM configuration – or as a "feedback signal" from the cell tower (picking up your example: if you had a 262-03 and book into a 262-07 tower, the tower would not set the "roaming flag" in its response). How do I get that idea? Well, I still have 262-03s in some of my devices. I didn't make an upgrade to the system when the merge took place. I could book into 262-07 and don't remember having seen an R. But old man that I am, I might just have forgotten, of course :D
    – Izzy
    Oct 25, 2020 at 20:02
  • @Robert I am quite sure that there was something related to roaming networks in the Cyanogenmod change logs at some point. I doubt the decision is made by the SIM card alone: how would an old SIM (say, issued around 2000) know about a merger that happened a decade and a half later?
    – user149408
    Oct 26, 2020 at 11:13

1 Answer 1

4

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:

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .