Telephony CarrierConfig配置

1、CarrierConfig配置介绍

        CarrierConfig(运营商配置),是Android为了针对不同运营商配置不同功能的配置文件,类似Modem的MBN配置,可以实现插入不同运营商卡,不同的功能实现或菜单显示等。

2、CarrierConfig的架构

        CarrierConfig代码涉及

packages\apps\CarrierConfig

packages\services\Telephony

frameworks\base\telephony\java\android\service\carrier

        其中packages\services\Telephony进程主要实现ICarrierConfigLoader.aidl相关接口,提供给其他APP调用,

        packages\apps\CarrierConfig代码主要对框架类CarrierService进行复写,CarrierService有ICarrierService.aidl的实现。通过复写CarrierService的onLoadConfig函数,实现packages\services\Telephony跨进程调用packages\apps\CarrierConfig加载对应的配置CarrierConfig配置文件。

3、CarrierConfig的加载流程

        当插入对应SIM卡后,相关CarrierConfig流程加载如下

        可以看到最终调用到CarrierConfig的DefaultCarrierConfigService.java的onloadConfig函数,相关Log打印如下。

        当加载完成后,packages\services\Telephony会存缓存,路径如下,不同卡对应不同文件

/data/user_de/0/com.android.phone/files

onloadConfig函数的实现,可以看到加载优先级别如下

1、carrier_config_carrierid_*.xml

2、carrier_config_mccmnc_*.xml

3、vendor.xml

其中carrierid可以参考

packages\providers\TelephonyProvider\assets\latest_carrier_id\carrier_list.textpb中的描述,注意不要随意修该文件,google有CTS测试。

    注意:如果配置carrier_config_carrierid_*.xml后发现不生效,可以看下对应vendor.xml是否有复写,这个会覆盖carrier_config_carrierid_*.xml的配置的。

        无卡配置参考carrier_config_no_sim.xml,这里不做加载说明。

4、常用配置文件      

1、gsm cdma 是否可显示hd 图标  (可用于CSFB SRVCC)
gsm_cdma_calls_can_be_hd_audio

2、默认vowifi开关
carrier_default_wfc_ims_enabled_bool

3、vt是否可用
carrier_vt_available_bool

4、紧急呼是否可以存在与通话记录
allow_emergency_numbers_in_call_log_bool

5、Volte是否可用
carrier_volte_available_bool

6、vowifi是否可用
carrier_wfc_ims_available_bool

7、Vowifi优先级
carrier_default_wfc_ims_mode_int

8、是否使用ut
carrier_supports_ss_over_ut_bool

9、Call Settings中call barring是否可见

call_barring_visibility_bool

10、短信在收到多少条后会变成彩信

smsToMmsTextThreshold

11、显示4G+图标

hide_lte_plus_data_icon_bool 配置为false

lte_plus_threshold_bandwidth_khz_int LTE载波聚合默认20M,是否需要配置看4G+带宽

12、Voice mail number是否允许编辑
<boolean name="editable_voicemail_number_setting_bool" value="false"/>
13、Voice mail number默认语音信箱号码
<string name="default_vm_number_string">*86</string>

14、漫游模式数据默认开关

<boolean name="carrier_default_data_roaming_enabled_bool" value="true"/>

15、显示H+图标

<boolean name="hide_3g_plus_data_icon_bool" value="false"/>

16、volte开关是否置灰

editable_enhanced_4g_lte_bool

17、短信中心(SMSC)号码不可编辑

<boolean name="allowEditingSmscAddress" value="false" />

18、4G RAT图标显示LTE

<boolean name="show_4g_for_lte_data_icon_bool" value="false"/>

19、video call forward可用

<boolean name="supports_video_callforward_bool" value="true"/>

20、vilte关闭数据业务可用

vilte_data_is_metered_bool

21、视频通话合并按钮

support_video_conference_call_bool 

默认配置也可以参考CarrierConfigManager.java的的文件

/** * Perform the specified type of NV config reset. The radio will be taken offline * and the device must be rebooted after the operation. Used for device * configuration by some CDMA operators. * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * * TODO: remove this one. use {@link #rebootRadio()} for reset type 1 and * {@link #resetRadioConfig()} for reset type 3 * * @param resetType reset type: 1: reload NV reset, 2: erase NV reset, 3: factory NV reset * @return true on success; false on any failure. * * @hide */ @UnsupportedAppUsage public boolean nvResetConfig(int resetType) { try { ITelephony telephony = getITelephony(); if (telephony != null) { if (resetType == 1 /*1: reload NV reset */) { return telephony.rebootModem(getSlotIndex()); } else if (resetType == 3 /3: factory NV reset /) { return telephony.resetModemConfig(getSlotIndex()); } else { Rlog.e(TAG, "nvResetConfig unsupported reset type"); } } } catch (RemoteException ex) { Rlog.e(TAG, "nvResetConfig RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "nvResetConfig NPE", ex); } return false; } / * Rollback modem configurations to factory default except some config which are in whitelist. * Used for device configuration by some carriers. * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return {@code true} on success; {@code false} on any failure. * * @hide */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @SystemApi public boolean resetRadioConfig() { try { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.resetModemConfig(getSlotIndex()); } } catch (RemoteException ex) { Rlog.e(TAG, "resetRadioConfig RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "resetRadioConfig NPE", ex); } return false; }这两个接口是否可以恢复相关的网络
07-14
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值