A test api to override carrier information
This API should only be used for testing purpose e.g., CTS/GTS/SL4A
By overriding carrier information, we could force a particular carrier id,
carrier's config, but also any country or carrier overlays to be loaded
when using a test SIM with a call box.
Bug: 72332597
Test: atest CtsTelephonyTestCases:CarrierIdentificationTest
Change-Id: Ia66a520970c845c10c06db929ca0b05718550167
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index a13cd11..9464d1a 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -4177,4 +4177,27 @@
DEFAULT_NETWORK_MODE_PROPERTY_NAME,
String.valueOf(Phone.PREFERRED_NT_MODE)));
}
+
+ @Override
+ public void setCarrierTestOverride(int subId, String mccmnc, String imsi, String iccid, String
+ gid1, String gid2, String plmn, String spn) {
+ enforceModifyPermission();
+ final Phone phone = getPhone(subId);
+ if (phone == null) {
+ loge("setCarrierTestOverride fails with invalid subId: " + subId);
+ return;
+ }
+ phone.setCarrierTestOverride(mccmnc, imsi, iccid, gid1, gid2, plmn, spn);
+ }
+
+ @Override
+ public int getCarrierIdListVersion(int subId) {
+ enforceReadPrivilegedPermission();
+ final Phone phone = getPhone(subId);
+ if (phone == null) {
+ loge("getCarrierIdListVersion fails with invalid subId: " + subId);
+ return TelephonyManager.UNKNOWN_CARRIER_ID_LIST_VERSION;
+ }
+ return phone.getCarrierIdListVersion();
+ }
}