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

Commit b04e9a0c authored by kailua's avatar kailua
Browse files

EuiccCardController: Avoid NPE for legacy euicc devices

* EuiccGoogle fails to switch eSIM if device uses legacy radio.config@1.0-1.
* This logic was missing since Android 13.

05-03 20:25:16.695 16706 16996 W Binder : Caught a RuntimeException from the binder stub implementation.
05-03 20:25:16.695 16706 16996 W Binder : java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
05-03 20:25:16.695 16706 16996 W Binder : at com.android.internal.telephony.euicc.EuiccCardController.getEnabledProfile(EuiccCardController.java:421)
05-03 20:25:16.695 16706 16996 W Binder : at com.android.internal.telephony.euicc.IEuiccCardController$Stub.onTransact(IEuiccCardController.java:275)
05-03 20:25:16.695 16706 16996 W Binder : at android.os.Binder.execTransactInternal(Binder.java:1411)
05-03 20:25:16.695 16706 16996 W Binder : at android.os.Binder.execTransact(Binder.java:1350)

Change-Id: I8f29486c4ee5ca4e74e257e680b2a84bd37bc38d
parent 63f9c423
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -416,9 +416,17 @@ public class EuiccCardController extends IEuiccCardController.Stub {

        String iccId = null;
        boolean isValidSlotPort = false;

        // Avoid NPE for legacy euicc devices
        UiccSlot mUiccSlot = getUiccSlotForEmbeddedCard(cardId);
        if (mUiccSlot != null && mUiccSlot.isValidPortIndex(portIndex)) {
            isValidSlotPort = true;
            iccId = mUiccSlot.getIccId(portIndex);
        }

        // get the iccid whether or not the port is active
        for (UiccSlot slot : mUiccController.getUiccSlots()) {
            if (slot.getEid().equals(cardId)) {
            if (slot != null && TextUtils.equals(slot.getEid(), cardId)) {
                // find the matching slot. first validate if the passing port index is valid.
                if (slot.isValidPortIndex(portIndex)) {
                    isValidSlotPort = true;