【GTS 6.0_R2】 failed com.google.android.nmgiarc.gts.CarrierServicesTests#testCarrierServicesIsTheDefaultImsPackage

问题描述


GTS 6.0_R2 failed com.google.android.nmgiarc.gts.CarrierServicesTests#testCarrierServicesIsTheDefaultImsPackage

junit.framework.AssertionFailedError: CS not the default IMS package.

解决方案


确认GMS包里是否有CarrierServices apk以及IMS app

在CarrierConfig裡須要有config_ims_package_override_string="com.google.android.ims"之res字串.

將其加入之後此測項可以pass,


11-05 21:19:58.937 12337 12353 I TestRunner: failed: testCarrierServicesIsTheDefaultImsPackage(com.google.android.nmgiarc.gts.CarrierServicesTests)
11-05 21:19:58.937 12337 12353 I TestRunner: ----- begin exception -----
11-05 21:19:58.938 12337 12353 I TestRunner: junit.framework.AssertionFailedError: CS not the default IMS package.
11-05 21:19:58.938 12337 12353 I TestRunner:  at junit.framework.Assert.fail(Assert.java:50)
11-05 21:19:58.938 12337 12353 I TestRunner:  at junit.framework.Assert.assertTrue(Assert.java:20)
相关code如下,错在以下高亮部分,
 carrierConfigManager.getConfig().getString("config_ims_package_override_string")这里没有获取到”com.google.android.ims“
请贵司检查相关配置
    private static final String CARRIER_SERVICES_PACKAGE = "com.google.android.ims";

    @SuppressLint({"NewApi"})
public void testCarrierServicesIsTheDefaultImsPackage() throws Exception {
if (isAcsaEffective() && packageExists(CARRIER_SERVICES_PACKAGE) && ApiLevelUtil.isAtLeast(26)) {
CarrierConfigManager carrierConfigManager = (CarrierConfigManager) getContext().getSystemService("carrier_config");
boolean z = false;
assertTrue("Could not get the carrier config manager.", carrierConfigManager != null);
String defaultImsPackage = carrierConfigManager.getConfig().getString("config_ims_package_override_string");
String str = "CS not the default IMS package.";
if (defaultImsPackage != null && defaultImsPackage.equals(CARRIER_SERVICES_PACKAGE)) {
z = true;
}
assertTrue(str, z);
}
需要在
/vendor/mediatek/proprietary/packages/apps/CarrierConfig/res/xml/vendor.xml
增加
<carrier_config>
  <string name="config_ims_package_override_string">com.google.android.ims</string>
</carrier_config>
如果不插卡测试,需要修改MtkCarrierConfigManager.java,因为无卡时carrier config使用默认设置,不会load xml,
vendor/mediatek/proprietary/frameworks/opt/telephony-base/java/mediatek/telephony/MtkCarrierConfigManager.java
里面增加
sDefaults.putString(CarrierConfigManager.KEY_CONFIG_IMS_PACKAGE_OVERRIDE_STRING, "com.google.android.ims");
    上面方法对插卡测试也有效。
     如果插卡测试,也可以在vendor.xml里面增加
     <carrier_config  mcc="xxx" mnc="xx">
         <string name="config_ims_package_override_string" value="com.google.android.ims" />
     </carrier_config>
     xxx请替换成测试所用卡的mcc and mnc, 修改只对此mccmnc卡有效.

作者: RESSRC

个人资源站

发表评论

邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据