Gaia/Settings/docs/Apn Settings

From MozillaWiki
< Gaia‎ | Settings‎ | docs
Jump to: navigation, search

APN settings are used for configuring various type of connections including data, message, gps, tethering, and ims. An APN item represents one setting but can be used for multiple types of connection at the same time. An APN settings looks like the following:

 {
   "carrier": "T-Mobile Internet",
   "apn": "internet",
   "authtype": "1",
   "type": ["default","supl"]
 }

The default APN setting is set based on GAIA_FOLDER/shared/resources/apn.json upon detecting a new sim card in system app. In addition to the default APN settings, users can create theirs, or install one from client provisioning messages sent from the carrier. The group of APN settings panels allows users to create and edit APN items. Users are able to see all available APN items and pick one for each type of connections.

In order to make gecko use the APN setting, it must be stored under the field ril.data.apnSettings. Note that not only settings app can change the APN setting but also system app and wappush app (when receiving client provisioning messages). That being said, settings app should match the value of ril.data.apnSettings to the available APN items in order to display the correct active ones.

ApnSettingsManager does the heavy lifting here. When we use queryApns#ApnSettingsManager to get available APN items, ApnSettingsManger does what we mentioned above and set an "active" property directly to the returning APN items. In addition to this, it also provides methods for creating, updating, and removing APN items. All APN panels actually use it under the hood.