博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Carrier Configuration
阅读量:6720 次
发布时间:2019-06-25

本文共 6015 字,大约阅读时间需要 20 分钟。

Carrier Configuration

The Android 6.0 Marshmallow release introduces a capability for privileged applications to provide carrier-specific configuration to the platform. This functionality, based on the introduced in Android 5.1 (Lollipop MR1), will allow carrier configuration to be moved away from the static configuration overlays and give carriers and OEMs the ability to dynamically provide carrier configuration to the platform through a defined interface.

A properly signed carrier app can either be preloaded in the system image, installed automatically, or manually installed through an app store. The app will be queried by the platform to provide configuration for settings including:

  • Roaming/Non-roaming networks
  • Visual Voicemail
  • SMS/MMS network settings
  • VoLTE/IMS configurations

Note: This app must be signed with the certificate that has a matching signature to one on the SIM. See the section for details.

The determination of what values to return is entirely up to the Carrier App and can be dynamic based on detailed information passed to the app via the platform.

The key benefits of this approach are:

  • Dynamic configuration - Support for concepts like non-MCCMNC derived configuration, for example mobile virtual network operators (MVNOs) or customer opt in to extra services
  • Support for devices sold through any channel - e.g. an open market phone can be automatically configured with the right settings by downloading an app from an app store.
  • Security - Privilege to provide this configuration is given only to applications signed by the carrier
  • Defined API - Previously this configuration was stored mostly in internal XML overlays within the framework and not through a public API. The carrier config API in Android 6.0 is public and well defined.

How it works


Loading the config

The carrier configuration supplied by this feature is a set of key-value pairs that change various telephony-related behaviors in the platform.

The set of values for a particular device is determined by querying the following components in order:

  1. The Carrier App (although this is technically optional, it is the recommended location for additional configuration beyond what exists in the Android Open Source Project - AOSP)
  2. The Platform Config App bundled with the system image
  3. Default values, hardcoded into the framework (equivalent to the behavior prior to M)

Important: If a value for a particular key is returned at any stage, the first value found takes precedence over the further stages.

The Platform Config App

A generic Platform Config App is bundled with the system image that can supply values for any variables the regular Carrier App does not. The platform config app can be found (in M) in: packages/apps/CarrierConfig

This app’s purpose is to provide some per-network configuration when a Carrier App is not installed, and carriers/OEMs should make only minimal changes to it in their own images. Instead carriers should provide the separate Carrier App for carrier customization, allowing updates to be distributed via avenues such as app stores.

How privilege is granted to a Carrier App

The Carrier App in question must be signed with the same certificate found on the SIM card, as documented in .

What information is passed to the Carrier App

The Carrier App is supplied with the following values, enabling it to make a dynamic decision as to what values to return:

  • MCC
  • MNC
  • SPN
  • IMSI
  • GID1
  • GID2

When loading the carrier config occurs

The building of the list of key value pairs occurs:

  • When the SIM is loaded (boot, or SIM hot swap)
  • When the Carrier app manually triggers a reload
  • When the Carrier app gets updated

See the reference for more details.

Note: The platform caches carrier configuration bundles and loads from the cache for SIM state changes. This is to speed up boot and SIM hot swap. It is assumed that without a package update or an explicit notifyConfigChangedForSubId, the config bundle has not been modified.

Using the config

Once the configuration has been built, the values contained within it are used to set various values of system configuration, including:

  • Internal framework telephony settings
  • SDK-returned configuration values, e.g. in SmsManager
  • App settings like VVM connection values in the Dialer

Configuration keys

The list of keys is defined as part of the public SDK in and cannot change within the same API level. See the table below for a summary of keys.

How to build your application


Create your application

Your application must target the Android 6.0 API level (23).

Declare a class that overrides android.service.carrier.CarrierService

  1. Override onLoadConfig to return the values you wish to supply based on the service.carrier.CarrierIdentifier object passed.
  2. Add logic to call notifyConfigChangedForSubId in scenarios where carrier configuration may change over time (e.g. when the user adds extra services to their account)

An example is below:

public class SampleCarrierConfigService extends CarrierService { private static final String TAG = "SampleCarrierConfigService"; public SampleCarrierConfigService() { Log.d(TAG, "Service created"); } @Override public PersistableBundle onLoadConfig(CarrierIdentifier id) { Log.d(TAG, "Config being fetched"); PersistableBundle config = new PersistableBundle(); config.putBoolean( CarrierConfigManager.KEY_CARRIER_VOLTE_AVAILABLE_BOOL, true); config.putBoolean( CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL, false); config.putInt(CarrierConfigManager.KEY_VOLTE_REPLACEMENT_RAT_INT, 6); // Check CarrierIdentifier and add more config if needed… return config; } }

Please see the reference on developer.android.com for more details.

Name the class in your manifest

An example is below:

Sign app with same certificate on SIM

See for the requirements.

Testing your application


Once you have built your configuration application, you can test your code with:

  • A SIM containing a valid certificate signature
  • A device running Android 6.0 and later, for example a Nexus device

转载地址:http://wqcmo.baihongyu.com/

你可能感兴趣的文章
【拓扑排序】确定比赛名次
查看>>
hibernate(三)基本配置,log4j、JUnit配置
查看>>
屏幕电脑变成了黑白屏模式
查看>>
curl模拟提交
查看>>
一张图看明白云计算架构核心竞争力
查看>>
clip实现圆环进度条
查看>>
Cacti中文版安装配置
查看>>
开始 新征程
查看>>
Ubuntu 14.04 安装 Grub Customizer 4.0.6
查看>>
51CTO推荐博客列表
查看>>
Linux文件系统破坏,导致系统无法启动解决办法
查看>>
一个老外关于mobile跨平台开发的感想
查看>>
linux系统日志管理工具logrotate之生产实例
查看>>
psacct工具 /var/account/pacct文件太大
查看>>
Windows系统管理笔记(6)
查看>>
java中的sortset集合
查看>>
cxgrid导出
查看>>
Exsi服务故障
查看>>
电子商务思维导图精品荟萃:电子商务思维导图大全
查看>>
使用NS2模拟多媒体通讯与无线网络(一)
查看>>