问题描述
GTS 6.0_R2 failed com.google.android.nmgiarc.gts.CarrierServicesTests#testCarrierServicesIsTheDefaultImsPackage
junit.framework.AssertionFailedError: CS not the default IMS package.
解决方案
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);
}
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>
这个case是需要插卡测试的,无卡测试也会fail。
特别提醒:
请一定是加在vendor.xml,
不要修改CarrierConfigManager.java里的默认值或者在MtkCarrierConfigManager.java里override默认值,
否则会有下面的Exception
E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.telephony.SubscriptionInfo.getSimSlotIndex()' on a null object reference
E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:1956)
E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1918)
E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1868)
E AndroidRuntime: at android.telephony.ims.aidl.IImsServiceController$Stub$Proxy.querySupportedImsFeatures(IImsServiceController.java:235)
E AndroidRuntime: at com.android.internal.telephony.ims.ImsServiceFeatureQueryManager$ImsServiceFeatureQuery.queryImsFeatures(ImsServiceFeatureQueryManager.java:88)
E AndroidRuntime: at com.android.internal.telephony.ims.ImsServiceFeatureQueryManager$ImsServiceFeatureQuery.onServiceConnected(ImsServiceFeatureQueryManager.java:73)
E AndroidRuntime: at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1730)
E AndroidRuntime: at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1762)
E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:1956)
E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1918)
E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1868)
E AndroidRuntime: at android.telephony.ims.aidl.IImsServiceController$Stub$Proxy.querySupportedImsFeatures(IImsServiceController.java:235)
E AndroidRuntime: at com.android.internal.telephony.ims.ImsServiceFeatureQueryManager$ImsServiceFeatureQuery.queryImsFeatures(ImsServiceFeatureQueryManager.java:88)
E AndroidRuntime: at com.android.internal.telephony.ims.ImsServiceFeatureQueryManager$ImsServiceFeatureQuery.onServiceConnected(ImsServiceFeatureQueryManager.java:73)
E AndroidRuntime: at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1730)
E AndroidRuntime: at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1762)