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

Commit 09560b2a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "return null for requestEnabledProfileForPort if no profile enabled"

parents 4e697208 eddc3722
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -390,14 +390,28 @@ public class EuiccCardController extends IEuiccCardController.Stub {
        }

        String iccId = null;

        boolean isValidSlotPort = false;
        // get the iccid whether or not the port is active
        for (UiccSlot slot : mUiccController.getUiccSlots()) {
            if (slot.getEid().equals(cardId)) {
                // find the matching slot. first validate if the passing port index is valid.
                if (slot.isValidPortIndex(portIndex)) {
                    isValidSlotPort = true;
                    iccId = slot.getIccId(portIndex);
                }
            }
        if (iccId.isEmpty()) {
        }
        if(!isValidSlotPort) {
            try {
                callback.onComplete(EuiccCardManager.RESULT_EUICC_NOT_FOUND, null);
            } catch (RemoteException exception) {
                loge("getEnabledProfile callback failure due to invalid port slot.",
                        exception);
            }
            return;
        }
        // if there is no iccid enabled on this port, return null.
        if (TextUtils.isEmpty(iccId)) {
            try {
                callback.onComplete(EuiccCardManager.RESULT_PROFILE_NOT_FOUND, null);
            } catch (RemoteException exception) {
+5 −0
Original line number Diff line number Diff line
@@ -239,6 +239,11 @@ public class UiccSlot extends Handler {
        }
    }

    /** Return whether the passing portIndex belong to this physical slot */
    public boolean isValidPortIndex(int portIndex) {
        return mPortIdxToPhoneId.containsKey(portIndex);
    }

    public int getPortIndexFromPhoneId(int phoneId) {
        synchronized (mLock) {
            for (Map.Entry<Integer, Integer> entry : mPortIdxToPhoneId.entrySet()) {