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

Commit acf26a69 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update data disconnected notification logic" into sc-dev

parents 34c9216c 07090b63
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1548,6 +1548,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");
@@ -5098,8 +5099,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
@@ -658,8 +658,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. */
@@ -1735,9 +1733,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();
        }

@@ -1837,7 +1833,6 @@ public class DcTracker extends Handler {
                        }

                        apnContext.setState(DctConstants.State.DISCONNECTING);
                        mDisconnectPendingCount++;
                    }
                } else {
                    // apn is connected but no reference to the data connection.
@@ -3296,10 +3291,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);
@@ -3307,16 +3301,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
@@ -3356,10 +3343,7 @@ public class DcTracker extends Handler {
            }
        }

        if (mDisconnectPendingCount > 0)
            mDisconnectPendingCount--;

        if (mDisconnectPendingCount == 0) {
        if (areAllDataDisconnected()) {
            apnContext.setConcurrentVoiceAndDataAllowed(
                    mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed());
            notifyAllDataDisconnected();
@@ -3412,7 +3396,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;
            }
        }
@@ -4785,8 +4769,7 @@ public class DcTracker extends Handler {

        mRequestedApnType = ApnSetting.TYPE_DEFAULT;

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