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

Commit 239b45f1 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed handover failed issue

For handover type setup request, we don't need
to check attached state. Modem will fail the
setup request if the conditions changed that
data setup is not allowed.

Bug: 130794830
Test: Manual
Change-Id: Ic17c43a70ce721f6684838974f53fd0054062515
parent 879c0ffc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1127,7 +1127,8 @@ public class DataConnection extends StateMachine {
        // unmetered.
        for (ApnContext apnContext : mApnContexts.keySet()) {
            DataConnectionReasons dataConnectionReasons = new DataConnectionReasons();
            boolean isDataAllowed = mDct.isDataAllowed(apnContext, dataConnectionReasons);
            boolean isDataAllowed = mDct.isDataAllowed(apnContext, DcTracker.REQUEST_TYPE_NORMAL,
                    dataConnectionReasons);
            if (!isDataAllowed || !dataConnectionReasons.contains(
                    DataConnectionReasons.DataAllowedReasonType.UNMETERED_APN)) {
                return false;
+6 −5
Original line number Diff line number Diff line
@@ -1221,7 +1221,7 @@ public class DcTracker extends Handler {
     * @return True if data connection is allowed, otherwise false.
     */
    public boolean isDataAllowed(DataConnectionReasons dataConnectionReasons) {
        return isDataAllowed(null, dataConnectionReasons);
        return isDataAllowed(null, REQUEST_TYPE_NORMAL, dataConnectionReasons);
    }

    /**
@@ -1229,12 +1229,13 @@ public class DcTracker extends Handler {
     *
     * @param apnContext APN context. If passing null, then will only check general but not APN
     *                   specific conditions (e.g. APN state, metered/unmetered APN).
     * @param requestType Setup data request type.
     * @param dataConnectionReasons Data connection allowed or disallowed reasons as the output
     *                              param. It's okay to pass null here and no reasons will be
     *                              provided.
     * @return True if data connection is allowed, otherwise false.
     */
    public boolean isDataAllowed(ApnContext apnContext,
    public boolean isDataAllowed(ApnContext apnContext, @RequestNetworkType int requestType,
                                 DataConnectionReasons dataConnectionReasons) {
        // Step 1: Get all environment conditions.
        // Step 2: Special handling for emergency APN.
@@ -1305,7 +1306,7 @@ public class DcTracker extends Handler {
            reasons.add(DataDisallowedReasonType.IN_ECBM);
        }

        if (!(attachedState || mAutoAttachEnabled.get())) {
        if (!attachedState && !mAutoAttachEnabled.get() && requestType != REQUEST_TYPE_HANDOVER) {
            reasons.add(DataDisallowedReasonType.NOT_ATTACHED);
        }
        if (!recordsLoaded) {
@@ -1453,7 +1454,7 @@ public class DcTracker extends Handler {
        }

        DataConnectionReasons dataConnectionReasons = new DataConnectionReasons();
        boolean isDataAllowed = isDataAllowed(apnContext, dataConnectionReasons);
        boolean isDataAllowed = isDataAllowed(apnContext, requestType, dataConnectionReasons);
        String logStr = "trySetupData for APN type " + apnContext.getApnType() + ", reason: "
                + apnContext.getReason() + ", requestType=" + requestTypeToString(requestType)
                + ". " + dataConnectionReasons.toString();
@@ -4288,7 +4289,7 @@ public class DcTracker extends Handler {
        final ApnContext apnContext = mApnContextsByType.get(apnType);
        if (apnContext == null) return;

        if (isDataAllowed(apnContext, null)) {
        if (isDataAllowed(apnContext, REQUEST_TYPE_NORMAL, null)) {
            if (apnContext.getDataConnection() != null) {
                apnContext.getDataConnection().reevaluateRestrictedState();
            }