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

Commit 7e802d08 authored by Jack Yu's avatar Jack Yu
Browse files

Prevent unnecessary waiting APN index reset

The RAT changed event causes waiting APNs set, which triggers
the unnecessary index reset (i.e. always start from the first
non-connectable APN).

Fix: 184315538
Test: Manual
Change-Id: Ia7e2c474c7ad13c016443390fa3db288342ff3dc
parent acf26a69
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;
@@ -256,7 +257,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();
    }

@@ -289,12 +290,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
@@ -3568,7 +3568,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>();

@@ -4740,7 +4741,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;