Optimize TM#getCarrierServicePackageName[ForLogicalSlot]
Implement TM#getCarrierServicePackageName[ForLogicalSlot] to
query the cache in CarrierPrivilegesTracker to boost
the performance.
Bug: 217442920
Test: atest CarrierPrivilegesTrackerTest
Change-Id: I8f5a9bfcab9c5923eada8a4abb336d347568d223
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 7572228..bcf9116 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6926,6 +6926,21 @@
return new ArrayList<>(privilegedPackages);
}
+ @Override
+ public @Nullable String getCarrierServicePackageNameForLogicalSlot(int logicalSlotIndex) {
+ enforceReadPrivilegedPermission("getCarrierServicePackageNameForLogicalSlot");
+
+ final Phone phone = PhoneFactory.getPhone(logicalSlotIndex);
+ if (phone == null) {
+ return null;
+ }
+ final CarrierPrivilegesTracker cpt = phone.getCarrierPrivilegesTracker();
+ if (cpt == null) {
+ return null;
+ }
+ return cpt.getCarrierServicePackageName();
+ }
+
private String getIccId(int subId) {
final Phone phone = getPhone(subId);
UiccPort port = phone == null ? null : phone.getUiccPort();