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

Commit 9e6c0621 authored by Jack Yu's avatar Jack Yu Committed by Automerger Merge Worker
Browse files

Merge "Fixed infinite loop in retry manager" into rvc-dev am: 7b6d97bf

Change-Id: I7d0085aee2c1c2e665f343330c8def2cedda75fd
parents 36565685 7b6d97bf
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.telephony;

import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.PersistableBundle;
@@ -487,10 +488,9 @@ public class RetryManager {

    /**
     * Get the next APN setting for data call setup.
     * @return APN setting to try
     * @return APN setting to try. {@code null} if cannot find any APN,
     */
    public ApnSetting getNextApnSetting() {

    public @Nullable ApnSetting getNextApnSetting() {
        if (mWaitingApns == null || mWaitingApns.size() == 0) {
            log("Waiting APN list is null or empty.");
            return null;
@@ -517,8 +517,10 @@ public class RetryManager {
                break;
            }

            // If we've already cycled through all the APNs, that means there is no APN we can try
            if (index == mCurrentApnIndex) return null;
            // If all APNs have permanently failed, bail out.
            if (mWaitingApns.stream().allMatch(ApnSetting::getPermanentFailed)) {
                return null;
            }
        }

        mCurrentApnIndex = index;
@@ -566,9 +568,8 @@ public class RetryManager {
                break;
            }

            // If we've already cycled through all the APNs, that means all APNs have
            // permanently failed
            if (index == mCurrentApnIndex) {
            // If all APNs have permanently failed, bail out.
            if (mWaitingApns.stream().allMatch(ApnSetting::getPermanentFailed)) {
                log("All APNs have permanently failed.");
                return NO_RETRY;
            }
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.telephony.dataconnection;

import android.annotation.Nullable;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.os.Message;
@@ -225,10 +226,10 @@ public class ApnContext {

    /**
     * Get the next available APN to try.
     * @return APN setting which will be used for data call setup. Return null if there is no
     * @return APN setting which will be used for data call setup.{@code null} if there is no
     * APN can be retried.
     */
    public ApnSetting getNextApnSetting() {
    public @Nullable ApnSetting getNextApnSetting() {
        return mRetryManager.getNextApnSetting();
    }