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

Commit d7da8c85 authored by Thomas Nguyen's avatar Thomas Nguyen
Browse files

Clear calling identity before querying SIM INFO table

Bug: 238693076
Test: run the following tests
- atest android.telephony.cts.SubscriptionManagerTest
- atest android.carrierapi.cts.CarrierApiTest

Change-Id: I7d58f6909e53fd58f53f8219a7b212a86b6759ec
parent bb8cd861
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -3525,9 +3525,7 @@ public class SubscriptionController extends ISub.Stub {
        try {
            int ret = setSubscriptionProperty(subId, SubscriptionManager.IS_OPPORTUNISTIC,
                    String.valueOf(opportunistic ? 1 : 0));

            if (ret != 0) notifySubscriptionInfoChanged();

            return ret;
        } finally {
            Binder.restoreCallingIdentity(token);
@@ -3544,8 +3542,15 @@ public class SubscriptionController extends ISub.Stub {

        SubscriptionManager subManager = (SubscriptionManager)
                mContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
        List<SubscriptionInfo> subInfo = getSubInfo(

        List<SubscriptionInfo> subInfo;
        long token = Binder.clearCallingIdentity();
        try {
            subInfo = getSubInfo(
                    SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + subId, null);
        } finally {
            Binder.restoreCallingIdentity(token);
        }

        try {
            if (!isActiveSubId(subId) && subInfo != null && subInfo.size() == 1