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

Commit 7629a941 authored by Hui Wang's avatar Hui Wang Committed by Amruth Ramachandran
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
Bug: 169502844
Test: Manual
Merged-In: I9b31ce000d6b74e61ef7e645c5f9ab301bd5ae3f
Change-Id: I9b31ce000d6b74e61ef7e645c5f9ab301bd5ae3f
(cherry picked from commit 595e9534)
parent 43164b3f
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2030,7 +2030,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();
@@ -2441,7 +2441,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;

@@ -2480,7 +2481,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;
                    }
                }