Carrier Identification

Devices running Android 9 can recognize subscription
carrier information to
provide an ID and a carrier name. Android maintains a carrier ID database, with
matching rules for each carrier and its unique carrier ID. AOSP includes the
content of the carrier ID database, in the file
carrier_list.textpb.
The unified database minimizes duplicate logic in apps that need to identify
carriers and limits the exposure of carrier-identifying attributes.

To improve the coverage and accuracy of carrier identification, Android supports
out-of-band and carrier ID table updates. Each update comes with a version
number and is published to AOSP.

Implementation

Place the carrier ID table in the /data/misc/carrierid/ data partition of the
device. If the carrier ID table is newer than the existing version, the device
persists the table to the
carrier ID database class.
The most recent information from the carrier ID database is picked up by the
public methods
getSimCarrierId()
and
getSimCarrierIdName().

Integrating carrier IDs with CarrierConfig

Integrating carrier IDs with CarrierConfig has the following advantages:

Consolidates all MCC/MNC pairs for each carrier into a single location
removing duplicate or inconsistent data.

Creates a canonical identifier for each carrier and removes ambiguity.

Allows mobile virtual network operators (MVNOs) to be identified with
individual IDs instead of having configurations as part of a mobile network
operator (MNO).

Migrating configuration data to carrier IDs

To migrate configuration data from MCC/MNC pairs to carrier IDs, follow
these steps:

Group the carrier_config_mccmnc.xml files from a single carrier together.
Use
carrier_list.textpb
as a reference to map the MCC, MNC, and MVNO information to a particular
carrier.

Merge the configurations into a single file.

(Optional) Inherit data from MNOs. MVNOs inherit configurations from
MNOs in the legacy carrier_config_mccmnc.xml file. Because carrier IDs
allow all carriers including MVNOs to have a dedicated config file, it's
recommended to include MNO data during migration.

If the configuration for an MVNO carrier ID doesn't exist, fetch the
configuration from its MNO carrier ID using
getCarrierIdFromSimMccMnc.

Rename the new file as
carrier_config_carrierid_carrierid_carriername.xml
where carrierid must correspond to a canonical_id and
carriername should correspond to a carrier_name in
carrier_list.textpb