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

Commit 0f70a4c0 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed that APN context stuck in SCANNING state

1. When data retry fails at trySetupData, we should apply
   FAILED state to the APN context otherwise it will be
   in SCANNING state forever since we are not going to
   schedule for the next retry.
2. When we get a new network request in applyNewState,
   if the APN is in SCANNING state, we should trySetupData
   immediately instead of waiting for the next retry,
   which might still minutes/hours away from now.

Test: Telephony sanity tests
bug: 38113800
Merged-In: I6edd7555327f41ee713a256edfe641a41ca6f969
Change-Id: I6edd7555327f41ee713a256edfe641a41ca6f969
parent 87056c26
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -1664,7 +1664,7 @@ public class DcTracker extends Handler {
            str.append("trySetupData failed. apnContext = [type=" + apnContext.getApnType() +
                    ", mState=" + apnContext.getState() + ", mDataEnabled=" +
                    apnContext.isEnabled() + ", mDependencyMet=" +
                    apnContext.getDependencyMet() + "] ");
                    apnContext.getDependencyMet() + "].");

            if (!apnContext.isConnectable()) {
                str.append(" isConnectable = false.");
@@ -1673,8 +1673,8 @@ public class DcTracker extends Handler {
                str.append(" data not allowed: " + failureReason.getDataAllowFailReason() + ".");
            }
            if (!isDataAllowedForApn(apnContext)) {
                str.append("isDataAllowedForApn = false. RAT = " +
                        mPhone.getServiceState().getRilDataRadioTechnology());
                str.append(" isDataAllowedForApn = false. RAT = "
                        + mPhone.getServiceState().getRilDataRadioTechnology() + ".");
            }
            if (!mDataEnabledSettings.isDataEnabled()) {
                str.append(" isDataEnabled() = false. "
@@ -1682,15 +1682,21 @@ public class DcTracker extends Handler {
                        + ", userDataEnabled = " + mDataEnabledSettings.isUserDataEnabled()
                        + ", isPolicyDataEnabled = " + mDataEnabledSettings.isPolicyDataEnabled()
                        + ", isCarrierDataEnabled = "
                        + mDataEnabledSettings.isCarrierDataEnabled());
                        + mDataEnabledSettings.isCarrierDataEnabled() + ".");
            }
            if (isEmergency()) {
                str.append("emergency = true");
                str.append(" emergency = true.");
            }

            // If this is a data retry, we should set the APN state to FAILED so it won't stay
            // in SCANNING forever.
            if (apnContext.getState() == DctConstants.State.SCANNING) {
                apnContext.setState(DctConstants.State.FAILED);
                str.append(" Stop retrying.");
            }

            if (DBG) log(str.toString());
            apnContext.requestLog(str.toString());

            return false;
        }
    }
@@ -2553,7 +2559,6 @@ public class DcTracker extends Handler {
                DctConstants.State state = apnContext.getState();
                switch(state) {
                    case CONNECTING:
                    case SCANNING:
                    case CONNECTED:
                    case DISCONNECTING:
                        // We're "READY" and active so just return
@@ -2563,6 +2568,7 @@ public class DcTracker extends Handler {
                    case IDLE:
                        // fall through: this is unexpected but if it happens cleanup and try setup
                    case FAILED:
                    case SCANNING:
                    case RETRYING: {
                        // We're "READY" but not active so disconnect (cleanup = true) and
                        // connect (trySetup = true) to be sure we retry the connection.