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

Commit b1435557 authored by Susheel Nyamala's avatar Susheel Nyamala Committed by android-build-merger
Browse files

Merge "Fix IMS PDN deactivate due to single pdn arbitration" am: ddc08749 am: 9239cb51

am: e1b7dd88

Change-Id: I825e925f222129df4dca0c3d8db467f2421b0c49
parents 07340242 e1b7dd88
Loading
Loading
Loading
Loading
+28 −11
Original line number Original line Diff line number Diff line
@@ -1535,22 +1535,29 @@ public class DcTracker extends Handler {
        if (!TextUtils.isEmpty(reason)) {
        if (!TextUtils.isEmpty(reason)) {
            disableMeteredOnly = reason.equals(Phone.REASON_DATA_SPECIFIC_DISABLED) ||
            disableMeteredOnly = reason.equals(Phone.REASON_DATA_SPECIFIC_DISABLED) ||
                    reason.equals(Phone.REASON_ROAMING_ON) ||
                    reason.equals(Phone.REASON_ROAMING_ON) ||
                    reason.equals(Phone.REASON_CARRIER_ACTION_DISABLE_METERED_APN);
                    reason.equals(Phone.REASON_CARRIER_ACTION_DISABLE_METERED_APN) ||
                    reason.equals(Phone.REASON_PDP_RESET);
        }
        }


        for (ApnContext apnContext : mApnContexts.values()) {
        for (ApnContext apnContext : mApnContexts.values()) {
            if (apnContext.isDisconnected() == false) didDisconnect = true;
            if (disableMeteredOnly) {
            if (disableMeteredOnly) {
                // Use ApnSetting to decide metered or non-metered.
                // Use ApnSetting to decide metered or non-metered.
                // Tear down all metered data connections.
                // Tear down all metered data connections.
                ApnSetting apnSetting = apnContext.getApnSetting();
                ApnSetting apnSetting = apnContext.getApnSetting();
                if (apnSetting != null && apnSetting.isMetered(mPhone)) {
                if (apnSetting != null && apnSetting.isMetered(mPhone)) {
                    if (apnContext.isDisconnected() == false) didDisconnect = true;
                    if (DBG) log("clean up metered ApnContext Type: " + apnContext.getApnType());
                    if (DBG) log("clean up metered ApnContext Type: " + apnContext.getApnType());
                    apnContext.setReason(reason);
                    apnContext.setReason(reason);
                    cleanUpConnection(tearDown, apnContext);
                    cleanUpConnection(tearDown, apnContext);
                }
                }
            } else {
            } else {
                // Exclude the IMS APN from single DataConenction case.
                if (reason.equals(Phone.REASON_SINGLE_PDN_ARBITRATION)
                        && apnContext.getApnType().equals(PhoneConstants.APN_TYPE_IMS)) {
                    continue;
                }
                // TODO - only do cleanup if not disconnected
                // TODO - only do cleanup if not disconnected
                if (apnContext.isDisconnected() == false) didDisconnect = true;
                apnContext.setReason(reason);
                apnContext.setReason(reason);
                cleanUpConnection(tearDown, apnContext);
                cleanUpConnection(tearDown, apnContext);
            }
            }
@@ -1973,6 +1980,7 @@ public class DcTracker extends Handler {
                    return false;
                    return false;
                }
                }


                if (!apnContext.getApnType().equals(PhoneConstants.APN_TYPE_IMS)) {
                    // Only lower priority calls left.  Disconnect them all in this single PDP case
                    // Only lower priority calls left.  Disconnect them all in this single PDP case
                    // so that we can bring up the requested higher priority call (once we receive
                    // so that we can bring up the requested higher priority call (once we receive
                    // response for deactivate request for the calls we are about to disconnect
                    // response for deactivate request for the calls we are about to disconnect
@@ -1980,9 +1988,11 @@ public class DcTracker extends Handler {
                        // If any call actually requested to be disconnected, means we can't
                        // If any call actually requested to be disconnected, means we can't
                        // bring up this connection yet as we need to wait for those data calls
                        // bring up this connection yet as we need to wait for those data calls
                        // to be disconnected.
                        // to be disconnected.
                    if (DBG) log("setupData: Some calls are disconnecting first.  Wait and retry");
                        if (DBG) log("setupData: Some calls are disconnecting first."
                                + " Wait and retry");
                        return false;
                        return false;
                    }
                    }
                }


                // No other calls are active, so proceed
                // No other calls are active, so proceed
                if (DBG) log("setupData: Single pdp. Continue setting up data call.");
                if (DBG) log("setupData: Single pdp. Continue setting up data call.");
@@ -2123,7 +2133,14 @@ public class DcTracker extends Handler {
     * @return true if higher priority active apn found
     * @return true if higher priority active apn found
     */
     */
    private boolean isHigherPriorityApnContextActive(ApnContext apnContext) {
    private boolean isHigherPriorityApnContextActive(ApnContext apnContext) {
        if (apnContext.getApnType().equals(PhoneConstants.APN_TYPE_IMS)) {
            return false;
        }

        for (ApnContext otherContext : mPrioritySortedApnContexts) {
        for (ApnContext otherContext : mPrioritySortedApnContexts) {
            if (otherContext.getApnType().equals(PhoneConstants.APN_TYPE_IMS)) {
                continue;
            }
            if (apnContext.getApnType().equalsIgnoreCase(otherContext.getApnType())) return false;
            if (apnContext.getApnType().equalsIgnoreCase(otherContext.getApnType())) return false;
            if (otherContext.isEnabled() && otherContext.getState() != DctConstants.State.FAILED) {
            if (otherContext.isEnabled() && otherContext.getState() != DctConstants.State.FAILED) {
                return true;
                return true;