Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d5e6a11 authored by Rambo Wang's avatar Rambo Wang Committed by Android (Google) Code Review
Browse files

Merge "Carrier app with carrier privileges can't access SubscriptionPlan APIs" into main

parents 38d0fe53 0c29e2b8
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -3612,13 +3612,16 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
        final long token = Binder.clearCallingIdentity();
        try {
            config = mCarrierConfigManager.getConfigForSubId(subId);
            tm = mContext.getSystemService(TelephonyManager.class);
            tm = mContext.getSystemService(TelephonyManager.class).createForSubscriptionId(subId);
        } finally {
            Binder.restoreCallingIdentity(token);
        }

        // First check: does caller have carrier privilege?
        if (tm != null && tm.hasCarrierPrivileges(subId)) {
        // First check: does callingPackage have carrier privilege?
        // Note that we can't call TelephonyManager.hasCarrierPrivileges() which will check if
        // ourself has carrier privileges
        if (tm != null && (tm.checkCarrierPrivilegesForPackage(callingPackage)
                == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS)) {
            return;
        }