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

Commit 40e7fe7f authored by Brad Ebinger's avatar Brad Ebinger Committed by Android (Google) Code Review
Browse files

Merge "Fix a few NPEs due to trying to access a null collection's iterator" into rvc-dev

parents 7c0ba434 0c37598e
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
@@ -5040,19 +5040,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;
    }
@@ -5749,6 +5753,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()) {
@@ -5756,6 +5761,7 @@ public class ServiceStateTracker extends Handler {
                    }
                }
            }
        }

        return idSet;
    }