Remove orphan methods in PhoneInterfaceManager
CarrierPrivilegesTracker has been the single source of truth for
carrier privileges check for all sources. The previous methods
getCarrierPrivilegeStatusFromCarrierConfigRules in PIM has
been obsoleted and becomes orphan now. It should be removed
to keep a better code health.
Bug: 224871263
Test: atest TelephonyManagerTest
Change-Id: I16cb044ed4858cf90782d1b93ac1f5048f3ad210
Merged-In: I16cb044ed4858cf90782d1b93ac1f5048f3ad210
(cherry picked from commit af6ebfa659bcb75e921f7d228263cfb0b061b411)
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index d884864..06114b5 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6695,69 +6695,6 @@
}
}
- private int getCarrierPrivilegeStatusFromCarrierConfigRules(int privilegeFromSim, int uid,
- Phone phone) {
- if (uid == Process.PHONE_UID) {
- // Skip the check if it's the phone UID (system UID removed in b/184713596)
- // TODO (b/184954344): Check for system/phone UID at call site instead of here
- return TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
- }
-
- //load access rules from carrier configs, and check those as well: b/139133814
- SubscriptionController subController = SubscriptionController.getInstance();
- if (privilegeFromSim == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS
- || subController == null) return privilegeFromSim;
-
- PackageManager pkgMgr = phone.getContext().getPackageManager();
- String[] packages = pkgMgr.getPackagesForUid(uid);
-
- final long identity = Binder.clearCallingIdentity();
- try {
- int subId = phone.getSubId();
- if (mCarrierPrivilegeTestOverrideSubIds.contains(subId)) {
- // A test override is in place for the privileges for this subId, so don't try to
- // read the subscription privileges.
- return privilegeFromSim;
- }
- SubscriptionInfo subInfo = subController.getSubscriptionInfo(subId);
- SubscriptionManager subManager = (SubscriptionManager)
- phone.getContext().getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
- for (String pkg : packages) {
- if (subManager.canManageSubscription(subInfo, pkg)) {
- return TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
- }
- }
- return privilegeFromSim;
- } finally {
- Binder.restoreCallingIdentity(identity);
- }
- }
-
- private int getCarrierPrivilegeStatusFromCarrierConfigRules(int privilegeFromSim, Phone phone,
- String pkgName) {
- //load access rules from carrier configs, and check those as well: b/139133814
- SubscriptionController subController = SubscriptionController.getInstance();
- if (privilegeFromSim == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS
- || subController == null) return privilegeFromSim;
-
- final long identity = Binder.clearCallingIdentity();
- try {
- int subId = phone.getSubId();
- if (mCarrierPrivilegeTestOverrideSubIds.contains(subId)) {
- // A test override is in place for the privileges for this subId, so don't try to
- // read the subscription privileges.
- return privilegeFromSim;
- }
- SubscriptionInfo subInfo = subController.getSubscriptionInfo(subId);
- SubscriptionManager subManager = (SubscriptionManager)
- phone.getContext().getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
- return subManager.canManageSubscription(subInfo, pkgName)
- ? TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS : privilegeFromSim;
- } finally {
- Binder.restoreCallingIdentity(identity);
- }
- }
-
@Override
public int getCarrierPrivilegeStatus(int subId) {
// No permission needed; this only lets the caller inspect their own status.