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

Commit 495f4967 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge changes Ic17c43a7,I14f3978c

* changes:
  Fixed handover failed issue
  Check for attached state explicitly before triggering data stall recovery
parents 282b448f 76fb2e18
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1127,7 +1127,8 @@ public class DataConnection extends StateMachine {
        // unmetered.
        for (ApnContext apnContext : mApnContexts.keySet()) {
            DataConnectionReasons dataConnectionReasons = new DataConnectionReasons();
            boolean isDataAllowed = mDct.isDataAllowed(apnContext, dataConnectionReasons);
            boolean isDataAllowed = mDct.isDataAllowed(apnContext, DcTracker.REQUEST_TYPE_NORMAL,
                    dataConnectionReasons);
            if (!isDataAllowed || !dataConnectionReasons.contains(
                    DataConnectionReasons.DataAllowedReasonType.UNMETERED_APN)) {
                return false;
+9 −11
Original line number Diff line number Diff line
@@ -1220,7 +1220,7 @@ public class DcTracker extends Handler {
     * @return True if data connection is allowed, otherwise false.
     */
    public boolean isDataAllowed(DataConnectionReasons dataConnectionReasons) {
        return isDataAllowed(null, dataConnectionReasons);
        return isDataAllowed(null, REQUEST_TYPE_NORMAL, dataConnectionReasons);
    }

    /**
@@ -1228,12 +1228,13 @@ public class DcTracker extends Handler {
     *
     * @param apnContext APN context. If passing null, then will only check general but not APN
     *                   specific conditions (e.g. APN state, metered/unmetered APN).
     * @param requestType Setup data request type.
     * @param dataConnectionReasons Data connection allowed or disallowed reasons as the output
     *                              param. It's okay to pass null here and no reasons will be
     *                              provided.
     * @return True if data connection is allowed, otherwise false.
     */
    public boolean isDataAllowed(ApnContext apnContext,
    public boolean isDataAllowed(ApnContext apnContext, @RequestNetworkType int requestType,
                                 DataConnectionReasons dataConnectionReasons) {
        // Step 1: Get all environment conditions.
        // Step 2: Special handling for emergency APN.
@@ -1304,7 +1305,7 @@ public class DcTracker extends Handler {
            reasons.add(DataDisallowedReasonType.IN_ECBM);
        }

        if (!(attachedState || mAutoAttachEnabled.get())) {
        if (!attachedState && !mAutoAttachEnabled.get() && requestType != REQUEST_TYPE_HANDOVER) {
            reasons.add(DataDisallowedReasonType.NOT_ATTACHED);
        }
        if (!recordsLoaded) {
@@ -1452,7 +1453,7 @@ public class DcTracker extends Handler {
        }

        DataConnectionReasons dataConnectionReasons = new DataConnectionReasons();
        boolean isDataAllowed = isDataAllowed(apnContext, dataConnectionReasons);
        boolean isDataAllowed = isDataAllowed(apnContext, requestType, dataConnectionReasons);
        String logStr = "trySetupData for APN type " + apnContext.getApnType() + ", reason: "
                + apnContext.getReason() + ", requestType=" + requestTypeToString(requestType)
                + ". " + dataConnectionReasons.toString();
@@ -4285,7 +4286,7 @@ public class DcTracker extends Handler {
        final ApnContext apnContext = mApnContextsByType.get(apnType);
        if (apnContext == null) return;

        if (isDataAllowed(apnContext, null)) {
        if (isDataAllowed(apnContext, REQUEST_TYPE_NORMAL, null)) {
            if (apnContext.getDataConnection() != null) {
                apnContext.getDataConnection().reevaluateRestrictedState();
            }
@@ -4481,12 +4482,9 @@ public class DcTracker extends Handler {
                if (VDBG_STALL) log("skip back to back data stall recovery");
                return false;
            }
            // Data is not allowed in current environment
            if (!isDataAllowed(null, null)) {
                log("skipped data stall recovery due to data is not allowd");
                return false;
            }
            return true;

            // Allow recovery if data is expected to work
            return mAttached.get() && isDataAllowed(null);
        }

        private void triggerRecovery() {