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

Commit 099ed45e authored by Jack Yu's avatar Jack Yu Committed by Automerger Merge Worker
Browse files

Merge "Prevent unnecessary waiting APN index reset" am: 43af3564

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1692374

Change-Id: Ia2b7d9e618ea811208482bc671b0f02b251863fa
parents 8d1d550e 43af3564
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ public class RetryManager {
     * The list to store APN setting candidates for data call setup. Most of the carriers only have
     * one APN, but few carriers have more than one.
     */
    private ArrayList<ApnSetting> mWaitingApns = null;
    private ArrayList<ApnSetting> mWaitingApns = new ArrayList<>();

    /**
     * Index pointing to the current trying APN from mWaitingApns
@@ -683,7 +683,7 @@ public class RetryManager {
     * Get the list of waiting APNs.
     * @return the list of waiting APNs
     */
    public ArrayList<ApnSetting> getWaitingApns() {
    public @NonNull ArrayList<ApnSetting> getWaitingApns() {
        return mWaitingApns;
    }

+4 −5
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.telephony.dataconnection;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
@@ -255,7 +256,7 @@ public class ApnContext {
     * Get the list of waiting APNs.
     * @return the list of waiting APNs
     */
    public ArrayList<ApnSetting> getWaitingApns() {
    public @NonNull ArrayList<ApnSetting> getWaitingApns() {
        return mRetryManager.getWaitingApns();
    }

@@ -288,12 +289,10 @@ public class ApnContext {
        }

        if (mState == DctConstants.State.FAILED) {
            if (mRetryManager.getWaitingApns() != null) {
            // when teardown the connection and set to IDLE
            mRetryManager.getWaitingApns().clear();
        }
    }
    }

    /**
     * Get the current data call state.
+6 −2
Original line number Diff line number Diff line
@@ -3504,7 +3504,8 @@ public class DcTracker extends Handler {
     * @return waitingApns list to be used to create PDP
     *          error when waitingApns.isEmpty()
     */
    private ArrayList<ApnSetting> buildWaitingApns(String requestedApnType, int radioTech) {
    private @NonNull ArrayList<ApnSetting> buildWaitingApns(String requestedApnType,
            int radioTech) {
        if (DBG) log("buildWaitingApns: E requestedApnType=" + requestedApnType);
        ArrayList<ApnSetting> apnList = new ArrayList<ApnSetting>();

@@ -4673,7 +4674,10 @@ public class DcTracker extends Handler {
                if (!apnContext.isDisconnected()) {
                    ArrayList<ApnSetting> waitingApns = buildWaitingApns(
                            apnContext.getApnType(), getDataRat());
                    if (apnContext.getWaitingApns().size() != waitingApns.size()
                            || !apnContext.getWaitingApns().containsAll(waitingApns)) {
                        apnContext.setWaitingApns(waitingApns);
                    }
                    for (ApnSetting apnSetting : waitingApns) {
                        if (areCompatible(apnSetting, apnContext.getApnSetting())) {
                            cleanupRequired = false;