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

Commit af891393 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Base APN State on the state of the ApnContext." into nyc-dev

parents 7f14ab63 5452ccfc
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -508,12 +508,6 @@ public class GsmCdmaPhone extends Phone {
            // Emergency APN is available even in Out Of Service
            // Pass the actual State of EPDN

            ret = PhoneConstants.DataState.DISCONNECTED;
        } else if (mDcTracker.isApnTypeEnabled(apnType) == false ||
                (!isPhoneTypeCdmaLte() && mDcTracker.isApnTypeActive(apnType) == false)) {
            //TODO: isApnTypeActive() is just checking whether ApnContext holds
            //      Dataconnection or not. Checking each ApnState below should
            //      provide the same state. Calling isApnTypeActive() can be removed.
            ret = PhoneConstants.DataState.DISCONNECTED;
        } else { /* mSST.gprsState == ServiceState.STATE_IN_SERVICE */
            switch (mDcTracker.getState(apnType)) {
+0 −19
Original line number Diff line number Diff line
@@ -1086,13 +1086,6 @@ public class DcTracker extends Handler {
        }
    }

    public boolean isApnTypeActive(String type) {
        ApnContext apnContext = mApnContexts.get(type);
        if (apnContext == null) return false;

        return (apnContext.getDcAc() != null);
    }

    public boolean isDataPossible(String apnType) {
        ApnContext apnContext = mApnContexts.get(apnType);
        if (apnContext == null) {
@@ -1243,18 +1236,6 @@ public class DcTracker extends Handler {
        return null;
    }

    public boolean isApnTypeEnabled(String apnType) {
        ApnContext apnContext = mApnContexts.get(apnType);
        if (apnContext == null) {
            return false;
        }
        return apnContext.isEnabled();
    }

    private void setState(DctConstants.State s) {
        if (DBG) log("setState should not be used in GSM" + s);
    }

    // Return state of specific apn type
    public DctConstants.State getState(String apnType) {
        ApnContext apnContext = mApnContexts.get(apnType);
+4 −4
Original line number Diff line number Diff line
@@ -222,14 +222,14 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
                PhoneConstants.APN_TYPE_ALL));

        // 2. GSM, getCurrentDataConnectionState != STATE_IN_SERVICE, apn = APN_TYPE_EMERGENCY, apn
        // not enabled and not active
        // not connected
        doReturn(DctConstants.State.IDLE).when(mDcTracker).getState(
                PhoneConstants.APN_TYPE_EMERGENCY);
        assertEquals(PhoneConstants.DataState.DISCONNECTED, mPhoneUT.getDataConnectionState(
                PhoneConstants.APN_TYPE_EMERGENCY));

        // 3. GSM, getCurrentDataConnectionState != STATE_IN_SERVICE, apn = APN_TYPE_EMERGENCY,
        // APN enabled, active and CONNECTED, callTracker state = idle
        doReturn(true).when(mDcTracker).isApnTypeEnabled(PhoneConstants.APN_TYPE_EMERGENCY);
        doReturn(true).when(mDcTracker).isApnTypeActive(PhoneConstants.APN_TYPE_EMERGENCY);
        // APN is connected, callTracker state = idle
        doReturn(DctConstants.State.CONNECTED).when(mDcTracker).getState(
                PhoneConstants.APN_TYPE_EMERGENCY);
        mCT.mState = PhoneConstants.State.IDLE;
+0 −8
Original line number Diff line number Diff line
@@ -62,10 +62,6 @@ public class DcTrackerMock extends DcTracker {
        throw new RuntimeException("Not Implemented");
    }
    @Override
    public boolean isApnTypeActive(String type) {
        throw new RuntimeException("Not Implemented");
    }
    @Override
    public boolean isDataPossible(String apnType) {
        throw new RuntimeException("Not Implemented");
    }
@@ -86,10 +82,6 @@ public class DcTrackerMock extends DcTracker {
        throw new RuntimeException("Not Implemented");
    }
    @Override
    public boolean isApnTypeEnabled(String apnType) {
        throw new RuntimeException("Not Implemented");
    }
    @Override
    public DctConstants.State getState(String apnType) {
        throw new RuntimeException("Not Implemented");
    }