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

Commit 31e23a36 authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Cleaned up dead code" am: 8ef74332

am: 20d7193b

Change-Id: I93337876f1520ce9829238571ce2c087ba7db78e
parents f13a2bc0 20d7193b
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
@@ -1044,13 +1044,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:
@@ -1313,7 +1312,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 &&
@@ -1407,8 +1406,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.");
            }
@@ -2148,15 +2147,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
@@ -2232,7 +2229,6 @@ public class DcTracker extends Handler {
                                                + " curApnCtx=" + curApnCtx);
                                    }
                                    return curDc;
                                case RETRYING:
                                case CONNECTING:
                                    potentialDc = curDc;
                                    potentialApnCtx = curApnCtx;
@@ -2252,7 +2248,6 @@ public class DcTracker extends Handler {
                                        + " curApnCtx=" + curApnCtx);
                            }
                            return curDc;
                        case RETRYING:
                        case CONNECTING:
                            potentialDc = curDc;
                            potentialApnCtx = curApnCtx;
@@ -2826,7 +2821,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);
@@ -2931,20 +2926,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;
@@ -3530,11 +3511,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());