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

Commit 291f4a38 authored by Sarah Chin's avatar Sarah Chin Committed by Gerrit Code Review
Browse files

Merge "Update data disconnected notification logic"

parents a550e607 3c8f0a45
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1543,6 +1543,7 @@ public class ServiceStateTracker extends Handler {
                    if (mPendingRadioPowerOffAfterDataOff) {
                        if (DBG) log("EVENT_ALL_DATA_DISCONNECTED, turn radio off now.");
                        hangupAndPowerOff();
                        mPendingRadioPowerOffAfterDataOffTag += 1;
                        mPendingRadioPowerOffAfterDataOff = false;
                    } else {
                        log("EVENT_ALL_DATA_DISCONNECTED is stale");
@@ -5062,8 +5063,8 @@ public class ServiceStateTracker extends Handler {
        synchronized(this) {
            if (mPendingRadioPowerOffAfterDataOff) {
                if (DBG) log("Process pending request to turn radio off.");
                mPendingRadioPowerOffAfterDataOffTag += 1;
                hangupAndPowerOff();
                mPendingRadioPowerOffAfterDataOffTag += 1;
                mPendingRadioPowerOffAfterDataOff = false;
                return true;
            }
+15 −32
Original line number Diff line number Diff line
@@ -659,8 +659,6 @@ public class DcTracker extends Handler {

    private SparseArray<ApnContext> mApnContextsByType = new SparseArray<ApnContext>();

    private int mDisconnectPendingCount = 0;

    private ArrayList<DataProfile> mLastDataProfileList = new ArrayList<>();

    /** RAT name ===> (downstream, upstream) bandwidth values from carrier config. */
@@ -1722,9 +1720,7 @@ public class DcTracker extends Handler {
        // TODO: Do we need mRequestedApnType?
        mRequestedApnType = ApnSetting.TYPE_DEFAULT;

        log("cleanUpAllConnectionsInternal: mDisconnectPendingCount = "
                + mDisconnectPendingCount);
        if (detach && mDisconnectPendingCount == 0) {
        if (areAllDataDisconnected()) {
            notifyAllDataDisconnected();
        }

@@ -1824,7 +1820,6 @@ public class DcTracker extends Handler {
                        }

                        apnContext.setState(DctConstants.State.DISCONNECTING);
                        mDisconnectPendingCount++;
                    }
                } else {
                    // apn is connected but no reference to the data connection.
@@ -3283,10 +3278,9 @@ public class DcTracker extends Handler {
    private void onDisconnectDone(ApnContext apnContext) {
        if(DBG) log("onDisconnectDone: EVENT_DISCONNECT_DONE apnContext=" + apnContext);
        apnContext.setState(DctConstants.State.IDLE);
        // if all data connection are gone, check whether Airplane mode request was
        // pending.
        if (areAllDataDisconnected()) {
            if (mPhone.getServiceStateTracker().processPendingRadioPowerOffAfterDataOff()) {
        // If all data connection are gone, check whether Airplane mode request was pending.
        if (areAllDataDisconnected()
                && mPhone.getServiceStateTracker().processPendingRadioPowerOffAfterDataOff()) {
            if (DBG) log("onDisconnectDone: radio will be turned off, no retries");
            // Radio will be turned off. No need to retry data setup
            apnContext.setApnSetting(null);
@@ -3294,16 +3288,9 @@ public class DcTracker extends Handler {

            // Need to notify disconnect as well, in the case of switching Airplane mode.
            // Otherwise, it would cause 30s delayed to turn on Airplane mode.
                if (mDisconnectPendingCount > 0) {
                    mDisconnectPendingCount--;
                }

                if (mDisconnectPendingCount == 0) {
            notifyAllDataDisconnected();
                }
            return;
        }
        }
        // If APN is still enabled, try to bring it back up automatically
        if (mAttached.get() && apnContext.isReady() && retryAfterDisconnected(apnContext)) {
            // Wait a bit before trying the next APN, so that
@@ -3343,10 +3330,7 @@ public class DcTracker extends Handler {
            }
        }

        if (mDisconnectPendingCount > 0)
            mDisconnectPendingCount--;

        if (mDisconnectPendingCount == 0) {
        if (areAllDataDisconnected()) {
            apnContext.setConcurrentVoiceAndDataAllowed(
                    mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed());
            notifyAllDataDisconnected();
@@ -3399,7 +3383,7 @@ public class DcTracker extends Handler {
    public boolean areAllDataDisconnected() {
        for (DataConnection dc : mDataConnections.values()) {
            if (!dc.isInactive()) {
                if (DBG) log("areAllDataDisconnected false due to DC: " + dc);
                if (DBG) log("areAllDataDisconnected false due to DC: " + dc.getName());
                return false;
            }
        }
@@ -4776,8 +4760,7 @@ public class DcTracker extends Handler {

        mRequestedApnType = ApnSetting.TYPE_DEFAULT;

        if (DBG) log("mDisconnectPendingCount = " + mDisconnectPendingCount);
        if (detach && mDisconnectPendingCount == 0) {
        if (areAllDataDisconnected()) {
            notifyAllDataDisconnected();
        }
    }