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

Commit c1de8afe authored by Shivakumar Neginal's avatar Shivakumar Neginal
Browse files

Handle NullPointerException during getIccId

There is possible rare scenario due to timing issue
in which port can be null for uicc card.
Hence null check is added before port object access.

Test: Manual basic(profile download/enable/switch/delete) sanity done.
Bug: 234460884
Change-Id: Id893380720122388a76b94fe35de268f4bbb3dcf
parent 0135e3e9
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.os.Registrant;
import android.os.RegistrantList;
import android.preference.PreferenceManager;
import android.sysprop.TelephonyProperties;
import android.telephony.AnomalyReporter;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -65,6 +66,7 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.stream.IntStream;

/**
@@ -910,8 +912,13 @@ public class UiccController extends Handler {
                    cardId = convertToPublicCardId(eid);
                } else {
                    // In case of non Euicc, use default port index to get the IccId.
                    String iccId = card.getUiccPort(TelephonyManager.DEFAULT_PORT_INDEX).getIccId();
                    // leave eid null if the UICC is not embedded
                    UiccPort port = card.getUiccPort(TelephonyManager.DEFAULT_PORT_INDEX);
                    if (port == null) {
                        AnomalyReporter.reportAnomaly(
                                UUID.fromString("92885ba7-98bb-490a-ba19-987b1c8b2055"),
                                "UiccController: Found UiccPort Null object.");
                    }
                    String iccId = (port != null) ? port.getIccId() : null;
                    cardId = convertToPublicCardId(iccId);
                }
            } else {