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

Commit 8ef74332 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge "Cleaned up dead code"

parents abedbf07 c9e177a9
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -344,7 +344,6 @@ public class ApnContext {
     */
    public boolean isConnectable() {
        return isReady() && ((mState == DctConstants.State.IDLE)
                                || (mState == DctConstants.State.SCANNING)
                                || (mState == DctConstants.State.RETRYING)
                                || (mState == DctConstants.State.FAILED));
    }
@@ -364,7 +363,6 @@ public class ApnContext {
    public boolean isConnectedOrConnecting() {
        return isReady() && ((mState == DctConstants.State.CONNECTED)
                                || (mState == DctConstants.State.CONNECTING)
                                || (mState == DctConstants.State.SCANNING)
                                || (mState == DctConstants.State.RETRYING));
    }

+0 −3
Original line number Diff line number Diff line
@@ -610,9 +610,6 @@ public class DataConnection extends StateMachine {
        notifyAllWithEvent(null, DctConstants.EVENT_DATA_SETUP_COMPLETE, reason);
    }

    private void notifyAllOfDisconnectDcRetrying(String reason) {
        notifyAllWithEvent(null, DctConstants.EVENT_DISCONNECT_DC_RETRYING, reason);
    }
    private void notifyAllDisconnectCompleted(@DataFailCause.FailCause int cause) {
        notifyAllWithEvent(null, DctConstants.EVENT_DISCONNECT_DONE,
                DataFailCause.toString(cause));
+20 −44
Original line number Diff line number Diff line
@@ -1043,13 +1043,12 @@ public class DcTracker extends Handler {
                    case DISCONNECTING:
                        if (VDBG) log("overall state is CONNECTED");
                        return DctConstants.State.CONNECTED;
                case RETRYING:
                    case CONNECTING:
                        isConnecting = true;
                        isFailed = false;
                        break;
                    case IDLE:
                case SCANNING:
                    case RETRYING:
                        isFailed = false;
                        break;
                    default:
@@ -1312,7 +1311,7 @@ public class DcTracker extends Handler {
            if (VDBG) log("setupDataOnConnectableApns: apnContext " + apnContext);

            if (apnContext.getState() == DctConstants.State.FAILED
                    || apnContext.getState() == DctConstants.State.SCANNING) {
                    || apnContext.getState() == DctConstants.State.RETRYING) {
                if (retryFailures == RetryFailures.ALWAYS) {
                    apnContext.releaseDataConnection(reason);
                } else if (apnContext.isConcurrentVoiceAndDataAllowed() == false &&
@@ -1406,8 +1405,8 @@ public class DcTracker extends Handler {
            }

            // If this is a data retry, we should set the APN state to FAILED so it won't stay
            // in SCANNING forever.
            if (apnContext.getState() == DctConstants.State.SCANNING) {
            // in RETRYING forever.
            if (apnContext.getState() == DctConstants.State.RETRYING) {
                apnContext.setState(DctConstants.State.FAILED);
                str.append(" Stop retrying.");
            }
@@ -2147,15 +2146,13 @@ public class DcTracker extends Handler {
                    case IDLE:
                        // fall through: this is unexpected but if it happens cleanup and try setup
                    case FAILED:
                    case SCANNING:
                    case RETRYING: {
                    case RETRYING:
                        // We're "READY" but not active so disconnect (cleanup = true) and
                        // connect (trySetup = true) to be sure we retry the connection.
                        trySetup = true;
                        apnContext.setReason(Phone.REASON_DATA_ENABLED);
                        break;
                }
                }
            } else if (met) {
                apnContext.setReason(Phone.REASON_DATA_DISABLED_INTERNAL);
                // If ConnectivityService has disabled this network, stop trying to bring
@@ -2231,7 +2228,6 @@ public class DcTracker extends Handler {
                                                + " curApnCtx=" + curApnCtx);
                                    }
                                    return curDc;
                                case RETRYING:
                                case CONNECTING:
                                    potentialDc = curDc;
                                    potentialApnCtx = curApnCtx;
@@ -2251,7 +2247,6 @@ public class DcTracker extends Handler {
                                        + " curApnCtx=" + curApnCtx);
                            }
                            return curDc;
                        case RETRYING:
                        case CONNECTING:
                            potentialDc = curDc;
                            potentialApnCtx = curApnCtx;
@@ -2823,7 +2818,7 @@ public class DcTracker extends Handler {
        // Check if we need to retry or not.
        if (delay >= 0) {
            if (DBG) log("onDataSetupCompleteError: Try next APN. delay = " + delay);
            apnContext.setState(DctConstants.State.SCANNING);
            apnContext.setState(DctConstants.State.RETRYING);
            // Wait a bit before trying the next APN, so that
            // we're not tying up the RIL command channel
            startAlarmForReconnect(delay, apnContext);
@@ -2928,20 +2923,6 @@ public class DcTracker extends Handler {

    }

    /**
     * Called when EVENT_DISCONNECT_DC_RETRYING is received.
     */
    private void onDisconnectDcRetrying(AsyncResult ar) {
        // We could just do this in DC!!!
        ApnContext apnContext = getValidApnContext(ar, "onDisconnectDcRetrying");
        if (apnContext == null) return;

        apnContext.setState(DctConstants.State.RETRYING);
        if(DBG) log("onDisconnectDcRetrying: apnContext=" + apnContext);

        mPhone.notifyDataConnection(apnContext.getReason(), apnContext.getApnType());
    }

    private void onVoiceCallStarted() {
        if (DBG) log("onVoiceCallStarted");
        mInVoiceCall = true;
@@ -3527,11 +3508,6 @@ public class DcTracker extends Handler {
                onDisconnectDone((AsyncResult) msg.obj);
                break;

            case DctConstants.EVENT_DISCONNECT_DC_RETRYING:
                log("DataConnectionTracker.handleMessage: EVENT_DISCONNECT_DC_RETRYING msg=" + msg);
                onDisconnectDcRetrying((AsyncResult) msg.obj);
                break;

            case DctConstants.EVENT_VOICE_CALL_STARTED:
                onVoiceCallStarted();
                break;
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ public class ApnContextTest extends TelephonyTest {
        mApnContext.setDependencyMet(true);
        assertFalse(mApnContext.isConnectable());

        mApnContext.setState(DctConstants.State.SCANNING);
        mApnContext.setState(DctConstants.State.RETRYING);
        assertTrue(mApnContext.isConnectable());
        assertTrue(mApnContext.isConnectedOrConnecting());