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

Commit fa92b7c4 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
Fixes: 158014610
Test: atest FrameworksTelephonyTests
Merged-In: Iae81d704a637c66eb706a5f881c26086d7ba3300
Change-Id: Iae81d704a637c66eb706a5f881c26086d7ba3300
parent 64e72304
Loading
Loading
Loading
Loading
+19 −14
Original line number Original line Diff line number Diff line
@@ -5039,19 +5039,22 @@ public class ServiceStateTracker extends Handler {
        List<SubscriptionInfo> subInfoList = SubscriptionController.getInstance()
        List<SubscriptionInfo> subInfoList = SubscriptionController.getInstance()
                .getActiveSubscriptionInfoList(mPhone.getContext().getOpPackageName(),
                .getActiveSubscriptionInfoList(mPhone.getContext().getOpPackageName(),
                        null);
                        null);
        if (!ArrayUtils.isEmpty(subInfoList)) {
            for (SubscriptionInfo info : subInfoList) {
            for (SubscriptionInfo info : subInfoList) {
            // If we have an active opportunistic subscription whose data is IN_SERVICE, we needs
                // If we have an active opportunistic subscription whose data is IN_SERVICE,
            // to get signal strength to decide data switching threshold. In this case, we poll
                // we need to get signal strength to decide data switching threshold. In this case,
            // latest signal strength from modem.
                // we poll latest signal strength from modem.
                if (info.isOpportunistic()) {
                if (info.isOpportunistic()) {
                    TelephonyManager tm = TelephonyManager.from(mPhone.getContext())
                    TelephonyManager tm = TelephonyManager.from(mPhone.getContext())
                            .createForSubscriptionId(info.getSubscriptionId());
                            .createForSubscriptionId(info.getSubscriptionId());
                    ServiceState ss = tm.getServiceState();
                    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 true;
                    }
                    }
                }
                }
            }
            }
        }


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


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


        return idSet;
        return idSet;
    }
    }