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

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

Merge "Cleaned up dead code"

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


+0 −3
Original line number Original line Diff line number Diff line
@@ -610,9 +610,6 @@ public class DataConnection extends StateMachine {
        notifyAllWithEvent(null, DctConstants.EVENT_DATA_SETUP_COMPLETE, reason);
        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) {
    private void notifyAllDisconnectCompleted(@DataFailCause.FailCause int cause) {
        notifyAllWithEvent(null, DctConstants.EVENT_DISCONNECT_DONE,
        notifyAllWithEvent(null, DctConstants.EVENT_DISCONNECT_DONE,
                DataFailCause.toString(cause));
                DataFailCause.toString(cause));
+20 −44
Original line number Original line Diff line number Diff line
@@ -1047,13 +1047,12 @@ public class DcTracker extends Handler {
                    case DISCONNECTING:
                    case DISCONNECTING:
                        if (VDBG) log("overall state is CONNECTED");
                        if (VDBG) log("overall state is CONNECTED");
                        return DctConstants.State.CONNECTED;
                        return DctConstants.State.CONNECTED;
                case RETRYING:
                    case CONNECTING:
                    case CONNECTING:
                        isConnecting = true;
                        isConnecting = true;
                        isFailed = false;
                        isFailed = false;
                        break;
                        break;
                    case IDLE:
                    case IDLE:
                case SCANNING:
                    case RETRYING:
                        isFailed = false;
                        isFailed = false;
                        break;
                        break;
                    default:
                    default:
@@ -1316,7 +1315,7 @@ public class DcTracker extends Handler {
            if (VDBG) log("setupDataOnConnectableApns: apnContext " + apnContext);
            if (VDBG) log("setupDataOnConnectableApns: apnContext " + apnContext);


            if (apnContext.getState() == DctConstants.State.FAILED
            if (apnContext.getState() == DctConstants.State.FAILED
                    || apnContext.getState() == DctConstants.State.SCANNING) {
                    || apnContext.getState() == DctConstants.State.RETRYING) {
                if (retryFailures == RetryFailures.ALWAYS) {
                if (retryFailures == RetryFailures.ALWAYS) {
                    apnContext.releaseDataConnection(reason);
                    apnContext.releaseDataConnection(reason);
                } else if (apnContext.isConcurrentVoiceAndDataAllowed() == false &&
                } else if (apnContext.isConcurrentVoiceAndDataAllowed() == false &&
@@ -1410,8 +1409,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
            // If this is a data retry, we should set the APN state to FAILED so it won't stay
            // in SCANNING forever.
            // in RETRYING forever.
            if (apnContext.getState() == DctConstants.State.SCANNING) {
            if (apnContext.getState() == DctConstants.State.RETRYING) {
                apnContext.setState(DctConstants.State.FAILED);
                apnContext.setState(DctConstants.State.FAILED);
                str.append(" Stop retrying.");
                str.append(" Stop retrying.");
            }
            }
@@ -2151,15 +2150,13 @@ public class DcTracker extends Handler {
                    case IDLE:
                    case IDLE:
                        // fall through: this is unexpected but if it happens cleanup and try setup
                        // fall through: this is unexpected but if it happens cleanup and try setup
                    case FAILED:
                    case FAILED:
                    case SCANNING:
                    case RETRYING:
                    case RETRYING: {
                        // We're "READY" but not active so disconnect (cleanup = true) and
                        // We're "READY" but not active so disconnect (cleanup = true) and
                        // connect (trySetup = true) to be sure we retry the connection.
                        // connect (trySetup = true) to be sure we retry the connection.
                        trySetup = true;
                        trySetup = true;
                        apnContext.setReason(Phone.REASON_DATA_ENABLED);
                        apnContext.setReason(Phone.REASON_DATA_ENABLED);
                        break;
                        break;
                }
                }
                }
            } else if (met) {
            } else if (met) {
                apnContext.setReason(Phone.REASON_DATA_DISABLED_INTERNAL);
                apnContext.setReason(Phone.REASON_DATA_DISABLED_INTERNAL);
                // If ConnectivityService has disabled this network, stop trying to bring
                // If ConnectivityService has disabled this network, stop trying to bring
@@ -2235,7 +2232,6 @@ public class DcTracker extends Handler {
                                                + " curApnCtx=" + curApnCtx);
                                                + " curApnCtx=" + curApnCtx);
                                    }
                                    }
                                    return curDc;
                                    return curDc;
                                case RETRYING:
                                case CONNECTING:
                                case CONNECTING:
                                    potentialDc = curDc;
                                    potentialDc = curDc;
                                    potentialApnCtx = curApnCtx;
                                    potentialApnCtx = curApnCtx;
@@ -2255,7 +2251,6 @@ public class DcTracker extends Handler {
                                        + " curApnCtx=" + curApnCtx);
                                        + " curApnCtx=" + curApnCtx);
                            }
                            }
                            return curDc;
                            return curDc;
                        case RETRYING:
                        case CONNECTING:
                        case CONNECTING:
                            potentialDc = curDc;
                            potentialDc = curDc;
                            potentialApnCtx = curApnCtx;
                            potentialApnCtx = curApnCtx;
@@ -2829,7 +2824,7 @@ public class DcTracker extends Handler {
        // Check if we need to retry or not.
        // Check if we need to retry or not.
        if (delay >= 0) {
        if (delay >= 0) {
            if (DBG) log("onDataSetupCompleteError: Try next APN. delay = " + delay);
            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
            // Wait a bit before trying the next APN, so that
            // we're not tying up the RIL command channel
            // we're not tying up the RIL command channel
            startAlarmForReconnect(delay, apnContext);
            startAlarmForReconnect(delay, apnContext);
@@ -2934,20 +2929,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() {
    private void onVoiceCallStarted() {
        if (DBG) log("onVoiceCallStarted");
        if (DBG) log("onVoiceCallStarted");
        mInVoiceCall = true;
        mInVoiceCall = true;
@@ -3533,11 +3514,6 @@ public class DcTracker extends Handler {
                onDisconnectDone((AsyncResult) msg.obj);
                onDisconnectDone((AsyncResult) msg.obj);
                break;
                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:
            case DctConstants.EVENT_VOICE_CALL_STARTED:
                onVoiceCallStarted();
                onVoiceCallStarted();
                break;
                break;
+1 −1
Original line number Original line Diff line number Diff line
@@ -111,7 +111,7 @@ public class ApnContextTest extends TelephonyTest {
        mApnContext.setDependencyMet(true);
        mApnContext.setDependencyMet(true);
        assertFalse(mApnContext.isConnectable());
        assertFalse(mApnContext.isConnectable());


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