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

Commit 5a8bc6cc authored by Susheel Nyamala's avatar Susheel Nyamala Committed by Linux Build Service Account
Browse files

Fix Ims pdn deactivate due to single pdn arbitration

Add exception for Ims pdn for clean up due to single pdn
arbitration.
Add support for Ims pdn to co-exist with other on non ims
pdn's in single pdn case.

Change-Id: I3c22abf0c1a90900936a0ac190cadc699c2eca69
CRs-Fixed: 949361
parent 71be9d22
Loading
Loading
Loading
Loading
+33 −18
Original line number Diff line number Diff line
@@ -1733,23 +1733,28 @@ public class DcTracker extends Handler {
        // Either user disable mobile data or under roaming service and user disabled roaming
        if (!TextUtils.isEmpty(reason)) {
            specificDisable = reason.equals(Phone.REASON_DATA_SPECIFIC_DISABLED) ||
                    reason.equals(Phone.REASON_ROAMING_ON);
                    reason.equals(Phone.REASON_ROAMING_ON) ||
                    reason.equals(Phone.REASON_SINGLE_PDN_ARBITRATION);
        }

        for (ApnContext apnContext : mApnContexts.values()) {
            if (apnContext.isDisconnected() == false) didDisconnect = true;
            if (specificDisable) {
                if (!apnContext.getApnType().equals(PhoneConstants.APN_TYPE_IMS)) {
                    // Use ApnSetting to decide metered or non-metered.
                    // Tear down all metered data connections.
                    ApnSetting apnSetting = apnContext.getApnSetting();
                    if (apnSetting != null && apnSetting.isMetered(mPhone.getContext(),
                        mPhone.getSubId(), mPhone.getServiceState().getDataRoaming())) {
                    if (DBG) log("clean up metered ApnContext Type: " + apnContext.getApnType());
                        if (apnContext.isDisconnected() == false) didDisconnect = true;
                        if (DBG) log("clean up metered ApnContext Type: " +
                                apnContext.getApnType());
                        apnContext.setReason(reason);
                        cleanUpConnection(tearDown, apnContext);
                    }
                }
            } else {
                // TODO - only do cleanup if not disconnected
                if (apnContext.isDisconnected() == false) didDisconnect = true;
                apnContext.setReason(reason);
                cleanUpConnection(tearDown, apnContext);
            }
@@ -2140,6 +2145,7 @@ public class DcTracker extends Handler {
                    return false;
                }

                if (!apnContext.getApnType().equals(PhoneConstants.APN_TYPE_IMS)) {
                    // 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
                    // response for deactivate request for the calls we are about to disconnect
@@ -2147,9 +2153,11 @@ public class DcTracker extends Handler {
                        // 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
                        // 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;
                    }
                }

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

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