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

Commit cf2a9c2f authored by chen xu's avatar chen xu Committed by Chen Xu
Browse files

notify all apn type when data connection is gone

today we only notify data disconnceted state for the last released
apn type. We might end up in a state that telephonyregistry still
think default data connected even data connection for default type
is gone. the fix is to notify all apn type which can be handled by
the disconnected data connection.

Bug: 129692801
Test: Manaul
Change-Id: I1b9f8fa5c7119f689845fcfdcabed5b7d27dd4ff
Merged-in: I1b9f8fa5c7119f689845fcfdcabed5b7d27dd4ff
parent b5b81e57
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()) {