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

Commit 06ad9752 authored by Muralidhar Reddy Mule's avatar Muralidhar Reddy Mule Committed by Automerger Merge Worker
Browse files

Merge "isSimPortAvailable API should return true if the calling app can...

Merge "isSimPortAvailable API should return true if the calling app can activate a new profile on the selected port without any user consent or deactivate dialog." into tm-qpr-dev am: af7bfc8b am: 023b8b00

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/20641600



Change-Id: I27b998064db27b9ea09535c5cad5f7d88ecada9f
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents d3c79fd8 023b8b00
Loading
Loading
Loading
Loading
+57 −45
Original line number Diff line number Diff line
@@ -1948,13 +1948,10 @@ public class EuiccController extends IEuiccController.Stub {

    @Override
    public boolean isSimPortAvailable(int cardId, int portIndex, String callingPackage) {
        List<UiccCardInfo> cardInfos;
        mAppOpsManager.checkPackage(Binder.getCallingUid(), callingPackage);
        final long token = Binder.clearCallingIdentity();
        try {
            cardInfos = mTelephonyManager.getUiccCardsInfo();
        } finally {
            Binder.restoreCallingIdentity(token);
        }
            List<UiccCardInfo> cardInfos = mTelephonyManager.getUiccCardsInfo();
            for (UiccCardInfo info : cardInfos) {
                if (info == null || info.getCardId() != cardId) {
                    continue;
@@ -1969,9 +1966,21 @@ public class EuiccController extends IEuiccController.Stub {
                    if (portInfo == null || portInfo.getPortIndex() != portIndex) {
                        continue;
                    }
                // Return false if port is not active.
                    if (!portInfo.isActive()) {
                    return false;
                        // port is inactive, check whether the caller can activate a new profile
                        // seamlessly. This is possible in below condition:
                        // 1. Device in DSDS Mode(P+E).
                        // 2. pSIM slot is active but no active subscription.
                        // 3. Caller has carrier privileges on any phone
                        boolean hasActiveRemovableNonEuiccSlot = getRemovableNonEuiccSlot() != null
                                && getRemovableNonEuiccSlot().isActive();
                        boolean hasCarrierPrivileges = mTelephonyManager
                                .checkCarrierPrivilegesForPackageAnyPhone(callingPackage)
                                == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
                        return mTelephonyManager.isMultiSimEnabled()
                                && hasActiveRemovableNonEuiccSlot
                                && !isRemovalNonEuiccSlotHasActiveSubscription()
                                && hasCarrierPrivileges;
                    }
                    // A port is available if it has no profiles enabled on it or calling app has
                    // Carrier privilege over the profile installed on the selected port.
@@ -2002,6 +2011,9 @@ public class EuiccController extends IEuiccController.Stub {
                            == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS);
                }
            }
        } finally {
            Binder.restoreCallingIdentity(token);
        }
        return false;
    }