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

Commit 0c37598e authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Fix a few NPEs due to trying to access a null collection's iterator

Bug: 155842924
Test: atest FrameworksTelephonyTests
Change-Id: Iae81d704a637c66eb706a5f881c26086d7ba3300
parent 1b9cd84d
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
@@ -5034,19 +5034,23 @@ public class ServiceStateTracker extends Handler {
        List<SubscriptionInfo> subInfoList = SubscriptionController.getInstance()
                .getActiveSubscriptionInfoList(mPhone.getContext().getOpPackageName(),
                        mPhone.getContext().getAttributionTag());

        if (!ArrayUtils.isEmpty(subInfoList)) {
            for (SubscriptionInfo info : subInfoList) {
            // If we have an active opportunistic subscription whose data is IN_SERVICE, we needs
            // to get signal strength to decide data switching threshold. In this case, we poll
            // latest signal strength from modem.
                // If we have an active opportunistic subscription whose data is IN_SERVICE,
                // we need to get signal strength to decide data switching threshold. In this case,
                // we poll latest signal strength from modem.
                if (info.isOpportunistic()) {
                    TelephonyManager tm = TelephonyManager.from(mPhone.getContext())
                            .createForSubscriptionId(info.getSubscriptionId());
                    ServiceState ss = tm.getServiceState();
                if (ss != null && ss.getDataRegistrationState() == ServiceState.STATE_IN_SERVICE) {
                    if (ss != null
                            && ss.getDataRegistrationState() == ServiceState.STATE_IN_SERVICE) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
@@ -5743,6 +5747,7 @@ public class ServiceStateTracker extends Handler {
    public Set<Integer> getNrContextIds() {
        Set<Integer> idSet = new HashSet<>();

        if (!ArrayUtils.isEmpty(mLastPhysicalChannelConfigList)) {
            for (PhysicalChannelConfig config : mLastPhysicalChannelConfigList) {
                if (isNrPhysicalChannelConfig(config)) {
                    for (int id : config.getContextIds()) {
@@ -5750,6 +5755,7 @@ public class ServiceStateTracker extends Handler {
                    }
                }
            }
        }

        return idSet;
    }