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

Commit 1bb17cbc 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: Ib7186801080c50a4f6aecf4a85e1e3f142c12a4e
parents 5b39fe75 7b6d97bf
Loading
Loading
Loading
Loading
+9 −8
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.internal.telephony;
package com.android.internal.telephony;


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


    /**
    /**
     * Get the next APN setting for data call setup.
     * 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) {
        if (mWaitingApns == null || mWaitingApns.size() == 0) {
            log("Waiting APN list is null or empty.");
            log("Waiting APN list is null or empty.");
            return null;
            return null;
@@ -517,8 +517,10 @@ public class RetryManager {
                break;
                break;
            }
            }


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


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


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


package com.android.internal.telephony.dataconnection;
package com.android.internal.telephony.dataconnection;


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


    /**
    /**
     * Get the next available APN to try.
     * 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.
     * APN can be retried.
     */
     */
    public ApnSetting getNextApnSetting() {
    public @Nullable ApnSetting getNextApnSetting() {
        return mRetryManager.getNextApnSetting();
        return mRetryManager.getNextApnSetting();
    }
    }