Merge "Update CarrierConfigLoader to use TM#getCarrierServicePackageName"
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 8a007b6..4f4b2a7 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -890,23 +890,16 @@
return new CarrierIdentifier(mcc, mnc, spn, imsi, gid1, gid2, carrierId, specificCarrierId);
}
- /** Returns the package name of a priveleged carrier app, or null if there is none. */
+ /** Returns the package name of a privileged carrier app, or null if there is none. */
@Nullable
private String getCarrierPackageForPhoneId(int phoneId) {
- List<String> carrierPackageNames;
final long token = Binder.clearCallingIdentity();
try {
- carrierPackageNames = TelephonyManager.from(mContext)
- .getCarrierPackageNamesForIntentAndPhone(
- new Intent(CarrierService.CARRIER_SERVICE_INTERFACE), phoneId);
+ return TelephonyManager.from(mContext)
+ .getCarrierServicePackageNameForLogicalSlot(phoneId);
} finally {
Binder.restoreCallingIdentity(token);
}
- if (carrierPackageNames != null && carrierPackageNames.size() > 0) {
- return carrierPackageNames.get(0);
- } else {
- return null;
- }
}
private String getIccIdForPhoneId(int phoneId) {
diff --git a/tests/src/com/android/phone/CarrierConfigLoaderTest.java b/tests/src/com/android/phone/CarrierConfigLoaderTest.java
index 9c605da..60c3a84 100644
--- a/tests/src/com/android/phone/CarrierConfigLoaderTest.java
+++ b/tests/src/com/android/phone/CarrierConfigLoaderTest.java
@@ -25,7 +25,6 @@
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
@@ -65,7 +64,6 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.util.List;
/**
* Unit Test for CarrierConfigLoader.
@@ -202,9 +200,8 @@
mContext.grantPermission(STUB_PERMISSION_ENABLE_ALL);
// Prepare to make sure we can save the config into the XML file which used as cache
- List<String> carrierPackages = List.of(PLATFORM_CARRIER_CONFIG_PACKAGE);
- doReturn(carrierPackages).when(mTelephonyManager).getCarrierPackageNamesForIntentAndPhone(
- nullable(Intent.class), anyInt());
+ doReturn(PLATFORM_CARRIER_CONFIG_PACKAGE).when(mTelephonyManager)
+ .getCarrierServicePackageNameForLogicalSlot(anyInt());
// Save the sample config into the XML file
PersistableBundle config = getTestConfig();