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

Commit 3a1a6f2e authored by Daniel Bright's avatar Daniel Bright Committed by Gerrit Code Review
Browse files

Merge "Fix concurrency bug w\ all apn list in DcTracker"

parents 9f0afd7a 66d049ce
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -195,10 +195,12 @@ public class DataConnection extends StateMachine {
        @RequestNetworkType
        @RequestNetworkType
        final int mRequestType;
        final int mRequestType;
        final int mSubId;
        final int mSubId;
        final boolean mIsPreferredApn;


        ConnectionParams(ApnContext apnContext, int profileId, int rilRadioTechnology,
        ConnectionParams(ApnContext apnContext, int profileId, int rilRadioTechnology,
                         Message onCompletedMsg, int connectionGeneration,
                         Message onCompletedMsg, int connectionGeneration,
                         @RequestNetworkType int requestType, int subId) {
                         @RequestNetworkType int requestType, int subId,
                         boolean isPreferredApn) {
            mApnContext = apnContext;
            mApnContext = apnContext;
            mProfileId = profileId;
            mProfileId = profileId;
            mRilRat = rilRadioTechnology;
            mRilRat = rilRadioTechnology;
@@ -206,6 +208,7 @@ public class DataConnection extends StateMachine {
            mConnectionGeneration = connectionGeneration;
            mConnectionGeneration = connectionGeneration;
            mRequestType = requestType;
            mRequestType = requestType;
            mSubId = subId;
            mSubId = subId;
            mIsPreferredApn = isPreferredApn;
        }
        }


        @Override
        @Override
@@ -216,6 +219,7 @@ public class DataConnection extends StateMachine {
                    + " mOnCompletedMsg=" + msgToString(mOnCompletedMsg)
                    + " mOnCompletedMsg=" + msgToString(mOnCompletedMsg)
                    + " mRequestType=" + DcTracker.requestTypeToString(mRequestType)
                    + " mRequestType=" + DcTracker.requestTypeToString(mRequestType)
                    + " mSubId=" + mSubId
                    + " mSubId=" + mSubId
                    + " mIsPreferredApn=" + mIsPreferredApn
                    + "}";
                    + "}";
        }
        }
    }
    }
@@ -669,7 +673,7 @@ public class DataConnection extends StateMachine {
        msg.obj = cp;
        msg.obj = cp;


        DataProfile dp = DcTracker.createDataProfile(mApnSetting, cp.mProfileId,
        DataProfile dp = DcTracker.createDataProfile(mApnSetting, cp.mProfileId,
                mApnSetting.equals(mDct.getPreferredApn()));
                cp.mIsPreferredApn);


        // We need to use the actual modem roaming state instead of the framework roaming state
        // We need to use the actual modem roaming state instead of the framework roaming state
        // here. This flag is only passed down to ril_service for picking the correct protocol (for
        // here. This flag is only passed down to ril_service for picking the correct protocol (for
@@ -2631,16 +2635,17 @@ public class DataConnection extends StateMachine {
     *                             ignored if obsolete.
     *                             ignored if obsolete.
     * @param requestType Data request type
     * @param requestType Data request type
     * @param subId the subscription id associated with this data connection.
     * @param subId the subscription id associated with this data connection.
     * @param isApnPreferred whether or not the apn is preferred.
     */
     */
    public void bringUp(ApnContext apnContext, int profileId, int rilRadioTechnology,
    public void bringUp(ApnContext apnContext, int profileId, int rilRadioTechnology,
                        Message onCompletedMsg, int connectionGeneration,
                        Message onCompletedMsg, int connectionGeneration,
                        @RequestNetworkType int requestType, int subId) {
                        @RequestNetworkType int requestType, int subId, boolean isApnPreferred) {
        if (DBG) {
        if (DBG) {
            log("bringUp: apnContext=" + apnContext + " onCompletedMsg=" + onCompletedMsg);
            log("bringUp: apnContext=" + apnContext + " onCompletedMsg=" + onCompletedMsg);
        }
        }
        sendMessage(DataConnection.EVENT_CONNECT,
        sendMessage(DataConnection.EVENT_CONNECT,
                new ConnectionParams(apnContext, profileId, rilRadioTechnology, onCompletedMsg,
                new ConnectionParams(apnContext, profileId, rilRadioTechnology, onCompletedMsg,
                        connectionGeneration, requestType, subId));
                        connectionGeneration, requestType, subId, isApnPreferred));
    }
    }


    /**
    /**
+17 −2
Original line number Original line Diff line number Diff line
@@ -2051,10 +2051,23 @@ public class DcTracker extends Handler {
        Message msg = obtainMessage();
        Message msg = obtainMessage();
        msg.what = DctConstants.EVENT_DATA_SETUP_COMPLETE;
        msg.what = DctConstants.EVENT_DATA_SETUP_COMPLETE;
        msg.obj = new Pair<ApnContext, Integer>(apnContext, generation);
        msg.obj = new Pair<ApnContext, Integer>(apnContext, generation);

        ApnSetting preferredApn = getPreferredApn();
        boolean isPreferredApn = apnSetting.equals(preferredApn);
        dataConnection.bringUp(apnContext, profileId, radioTech, msg, generation, requestType,
        dataConnection.bringUp(apnContext, profileId, radioTech, msg, generation, requestType,
                mPhone.getSubId());
                mPhone.getSubId(), isPreferredApn);


        if (DBG) log("setupData: initing!");
        if (DBG) {
            if (isPreferredApn) {
                log("setupData: initing! isPreferredApn=" + isPreferredApn
                        + ", apnSetting={" + apnSetting.toString() + "}");
            } else {
                String preferredApnStr = preferredApn == null ? "null" : preferredApn.toString();
                log("setupData: initing! isPreferredApn=" + isPreferredApn
                        + ", apnSetting={" + apnSetting + "}"
                        + ", preferredApn={" + preferredApnStr + "}");
            }
        }
        return true;
        return true;
    }
    }


@@ -3425,7 +3438,9 @@ public class DcTracker extends Handler {
        }
        }
    }
    }


    @Nullable
    ApnSetting getPreferredApn() {
    ApnSetting getPreferredApn() {
        //Only call this method from main thread
        if (mAllApnSettings == null || mAllApnSettings.isEmpty()) {
        if (mAllApnSettings == null || mAllApnSettings.isEmpty()) {
            log("getPreferredApn: mAllApnSettings is empty");
            log("getPreferredApn: mAllApnSettings is empty");
            return null;
            return null;