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

Commit eddc3722 authored by Chen Xu's avatar Chen Xu
Browse files

return null for requestEnabledProfileForPort if no profile enabled

Previously we return an error code if there is no profile enabled on the
port. we shouldn't really treat this as an "error" as no profile enabled
is a valid scenario.

Bug: 218481513
Test: Build & Manual
Change-Id: I89f7bc33b97b10780679595f04a2a4a100020a89
parent 82c08ca2
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()) {