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

Commit 9769c045 authored by Chen Xu's avatar Chen Xu Committed by Android (Google) Code Review
Browse files

Merge "notify all apn type when data connection is gone" into qt-dev

parents 32e1b7f3 cf2a9c2f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -233,6 +233,11 @@ public class DataConnection extends StateMachine {

    int mTag;
    public int mCid;
    /**
     * Indicate this data connection has been transferred to the other transport type during
     * IWLAN and WWAN handover.
     */
    private boolean mHasTransferred;
    private final Map<ApnContext, ConnectionParams> mApnContexts = new ConcurrentHashMap<>();
    PendingIntent mReconnectIntent = null;

@@ -366,6 +371,10 @@ public class DataConnection extends StateMachine {
        return getCurrentState() == mActivatingState;
    }

    boolean hasBeenTransferred() {
        return mHasTransferred;
    }

    int getCid() {
        return mCid;
    }
@@ -1706,6 +1715,7 @@ public class DataConnection extends StateMachine {
                    mApnSetting != null ? (long) mApnSetting.getApnTypeBitmask() : 0L,
                    mApnSetting != null
                        ? mApnSetting.canHandleType(ApnSetting.TYPE_DEFAULT) : false);
            mHasTransferred = false;
        }
        @Override
        public boolean processMessage(Message msg) {
@@ -2882,6 +2892,7 @@ public class DataConnection extends StateMachine {
    public DcNetworkAgent transferNetworkAgent(DataConnection dataConnection,
                                               @TransportType int transportType) {
        mNetworkAgent.acquireOwnership(dataConnection, transportType);
        this.mHasTransferred = true;
        return mNetworkAgent;
    }

+11 −3
Original line number Diff line number Diff line
@@ -2919,9 +2919,17 @@ public class DcTracker extends Handler {
    private void onDisconnectDone(ApnContext apnContext) {
        if(DBG) log("onDisconnectDone: EVENT_DISCONNECT_DONE apnContext=" + apnContext);
        apnContext.setState(DctConstants.State.IDLE);

        mPhone.notifyDataConnection(apnContext.getApnType());

        final DataConnection dc = apnContext.getDataConnection();
        // when data connection is gone and not for handover, notify all apn types which
        // this data connection can handle. Note, this might not work if one apn type served for
        // multiple data connection.
        if (dc != null && dc.isInactive() && !dc.hasBeenTransferred()) {
            String[] types = ApnSetting.getApnTypesStringFromBitmask(
                    apnContext.getApnSetting().getApnTypeBitmask()).split(",");
            for (String type : types) {
                mPhone.notifyDataConnection(type);
            }
        }
        // if all data connection are gone, check whether Airplane mode request was
        // pending.
        if (isDisconnected()) {