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

Commit 595e9534 authored by Hui Wang's avatar Hui Wang
Browse files

Reuse the data connection if the apn setting is same as requested

There could be race condition if more than one data connections
use the same apn settings.

Bug: 162299025
Test: Manual
Change-Id: I9b31ce000d6b74e61ef7e645c5f9ab301bd5ae3f
parent 73461e8f
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1925,7 +1925,7 @@ public class DcTracker extends Handler {
        // this type.
        if (!apnContext.getApnType().equals(PhoneConstants.APN_TYPE_DUN)
                || ServiceState.isGsm(getDataRat())) {
            dataConnection = checkForCompatibleDataConnection(apnContext);
            dataConnection = checkForCompatibleDataConnection(apnContext, apnSetting);
            if (dataConnection != null) {
                // Get the apn setting used by the data connection
                ApnSetting dataConnectionApnSetting = dataConnection.getApnSetting();
@@ -2318,7 +2318,8 @@ public class DcTracker extends Handler {
        }
    }

    private DataConnection checkForCompatibleDataConnection(ApnContext apnContext) {
    private DataConnection checkForCompatibleDataConnection(ApnContext apnContext,
            ApnSetting nextApn) {
        int apnType = apnContext.getApnTypeBitmask();
        ArrayList<ApnSetting> dunSettings = null;

@@ -2357,7 +2358,7 @@ public class DcTracker extends Handler {
                                    + " found canHandle conn=" + curDc);
                        }
                        return curDc;
                    } else if (curDc.isActivating()) {
                    } else if (curDc.isActivating() || apnSetting.equals(nextApn)) {
                        potentialDc = curDc;
                    }
                }