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

Commit dd177518 authored by Wink Saville's avatar Wink Saville Committed by Android Git Automerger
Browse files

am 6e748780: Merge "CDMALTE: Evaluate data network type in pollStateDone()" into honeycomb-LTE

* commit '6e748780':
  CDMALTE: Evaluate data network type in pollStateDone()
parents 75c78dc3 6e748780
Loading
Loading
Loading
Loading
+34 −30
Original line number Diff line number Diff line
@@ -44,22 +44,14 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {

    CDMALTEPhone mCdmaLtePhone;

    private int gprsState = ServiceState.STATE_OUT_OF_SERVICE;

    private int newGPRSState = ServiceState.STATE_OUT_OF_SERVICE;
    private ServiceState  mLteSS;  // The last LTE state from Voice Registration

    public CdmaLteServiceStateTracker(CDMALTEPhone phone) {
        super(phone);
        mCdmaLtePhone = phone;
        if (DBG) log("CdmaLteServiceStateTracker Constructors");
    }

    /**
     * @return The current GPRS state. IN_SERVICE is the same as "attached" and
     *         OUT_OF_SERVICE is the same as detached.
     */
    public int getCurrentDataConnectionState() {
        return gprsState;
        mLteSS = new ServiceState();
        if (DBG) log("CdmaLteServiceStateTracker Constructors");
    }

    @Override
@@ -77,11 +69,13 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
    }

    /**
     * The LTE data connection state, only return true here
     * Set the cdmaSS for EVENT_POLL_STATE_REGISTRATION_CDMA
     */
    @Override
    protected boolean checkAdditionalDataAvaiable() {
        return newGPRSState != ServiceState.STATE_IN_SERVICE;
    protected void setCdmaTechnology(int radioTechnology) {
        // Called on voice registration state response.
        // Just record new CDMA radio technology
        newSS.setRadioTechnology(radioTechnology);
    }

    /**
@@ -109,14 +103,10 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
                }
            }

            newGPRSState = regCodeToServiceState(regState);
            // Not sure if this is needed in CDMALTE phone.
            // mDataRoaming = regCodeIsRoaming(regState);
            if (newGPRSState == ServiceState.STATE_IN_SERVICE) {
                this.newCdmaDataConnectionState = newGPRSState;
                newNetworkType = type;
                newSS.setRadioTechnology(type);
            }
            mLteSS.setRadioTechnology(type);
            mLteSS.setState(regCodeToServiceState(regState));
        } else {
            super.handlePollStateResultMessage(what, ar);
        }
@@ -216,6 +206,21 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {

    @Override
    protected void pollStateDone() {
        // determine data NetworkType from both LET and CDMA SS
        if (mLteSS.getState() == ServiceState.STATE_IN_SERVICE) {
            //in LTE service
            newNetworkType = mLteSS.getRadioTechnology();
            mNewDataConnectionState = mLteSS.getState();
            newSS.setRadioTechnology(newNetworkType);
            log("pollStateDone LTE/eHRPD STATE_IN_SERVICE newNetworkType = " + newNetworkType);
        } else {
            // LTE out of service, get CDMA Service State
            newNetworkType = newSS.getRadioTechnology();
            mNewDataConnectionState = radioTechnologyToDataServiceState(newNetworkType);
            log("pollStateDone CDMA STATE_IN_SERVICE newNetworkType = " + newNetworkType +
                " mNewDataConnectionState = " + mNewDataConnectionState);
        }

        if (DBG) log("pollStateDone: oldSS=[" + ss + "] newSS=[" + newSS + "]");

        boolean hasRegistered = ss.getState() != ServiceState.STATE_IN_SERVICE
@@ -225,15 +230,15 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
                && newSS.getState() != ServiceState.STATE_IN_SERVICE;

        boolean hasCdmaDataConnectionAttached =
            this.cdmaDataConnectionState != ServiceState.STATE_IN_SERVICE
                && this.newCdmaDataConnectionState == ServiceState.STATE_IN_SERVICE;
            mDataConnectionState != ServiceState.STATE_IN_SERVICE
                && mNewDataConnectionState == ServiceState.STATE_IN_SERVICE;

        boolean hasCdmaDataConnectionDetached =
            this.cdmaDataConnectionState == ServiceState.STATE_IN_SERVICE
                && this.newCdmaDataConnectionState != ServiceState.STATE_IN_SERVICE;
            mDataConnectionState == ServiceState.STATE_IN_SERVICE
                && mNewDataConnectionState != ServiceState.STATE_IN_SERVICE;

        boolean hasCdmaDataConnectionChanged =
            cdmaDataConnectionState != newCdmaDataConnectionState;
            mDataConnectionState != mNewDataConnectionState;

        boolean hasNetworkTypeChanged = networkType != newNetworkType;

@@ -272,9 +277,9 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
        }
        // Add an event log when connection state changes
        if (ss.getState() != newSS.getState()
                || cdmaDataConnectionState != newCdmaDataConnectionState) {
                || mDataConnectionState != mNewDataConnectionState) {
            EventLog.writeEvent(EventLogTags.CDMA_SERVICE_STATE_CHANGE, ss.getState(),
                    cdmaDataConnectionState, newSS.getState(), newCdmaDataConnectionState);
                    mDataConnectionState, newSS.getState(), mNewDataConnectionState);
        }

        ServiceState tss;
@@ -283,6 +288,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
        newSS = tss;
        // clean slate for next time
        newSS.setStateOutOfService();
        mLteSS.setStateOutOfService();

        // TODO: 4G Tech Handoff
        // if (has4gHandoff) {
@@ -309,11 +315,9 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
        cellLoc = newCellLoc;
        newCellLoc = tcl;

        cdmaDataConnectionState = newCdmaDataConnectionState;
        mDataConnectionState = mNewDataConnectionState;
        networkType = newNetworkType;

        gprsState = newCdmaDataConnectionState;

        newSS.setStateOutOfService(); // clean slate for next time

        if (hasNetworkTypeChanged) {
+22 −25
Original line number Diff line number Diff line
@@ -97,8 +97,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
    /**
     * Initially assume no data connection.
     */
    protected int cdmaDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE;
    protected int newCdmaDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE;
    protected int mDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE;
    protected int mNewDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE;
    protected int mRegistrationState = -1;
    protected RegistrantList cdmaForSubscriptionInfoReadyRegistrants = new RegistrantList();

@@ -217,8 +217,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
        phone.mRuimRecords.unregisterForRecordsLoaded(this);
        cm.unSetOnSignalStrengthUpdate(this);
        cm.unSetOnNITZTime(this);
        cr.unregisterContentObserver(this.mAutoTimeObserver);
        cr.unregisterContentObserver(this.mAutoTimeZoneObserver);
        cr.unregisterContentObserver(mAutoTimeObserver);
        cr.unregisterContentObserver(mAutoTimeZoneObserver);
    }

    @Override
@@ -548,10 +548,12 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
    }

    /**
    * The LTE data connection state, only return true here
    * Determine data network type based on radio technology.
    */
    protected boolean checkAdditionalDataAvaiable(){
        return true;
    protected void setCdmaTechnology(int radioTechnology){
        mNewDataConnectionState = radioTechnologyToDataServiceState(radioTechnology);
        newSS.setRadioTechnology(radioTechnology);
        newNetworkType = radioTechnology;
    }

    /**
@@ -639,12 +641,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
                    regCodeIsRoaming(registrationState) && !isRoamIndForHomeSystem(states[10]);
            newSS.setState (regCodeToServiceState(registrationState));

            if(checkAdditionalDataAvaiable()) {
                this.newCdmaDataConnectionState =
                        radioTechnologyToDataServiceState(radioTechnology);
                newSS.setRadioTechnology(radioTechnology);
                newNetworkType = radioTechnology;
            }
            setCdmaTechnology(radioTechnology);

            newSS.setCssIndicator(cssIndicator);
            newSS.setSystemAndNetworkId(systemId, networkId);
@@ -953,15 +950,15 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            && newSS.getState() != ServiceState.STATE_IN_SERVICE;

        boolean hasCdmaDataConnectionAttached =
            this.cdmaDataConnectionState != ServiceState.STATE_IN_SERVICE
            && this.newCdmaDataConnectionState == ServiceState.STATE_IN_SERVICE;
            mDataConnectionState != ServiceState.STATE_IN_SERVICE
            && mNewDataConnectionState == ServiceState.STATE_IN_SERVICE;

        boolean hasCdmaDataConnectionDetached =
            this.cdmaDataConnectionState == ServiceState.STATE_IN_SERVICE
            && this.newCdmaDataConnectionState != ServiceState.STATE_IN_SERVICE;
            mDataConnectionState == ServiceState.STATE_IN_SERVICE
            && mNewDataConnectionState != ServiceState.STATE_IN_SERVICE;

        boolean hasCdmaDataConnectionChanged =
                       cdmaDataConnectionState != newCdmaDataConnectionState;
                       mDataConnectionState != mNewDataConnectionState;

        boolean hasNetworkTypeChanged = networkType != newNetworkType;

@@ -975,10 +972,10 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {

        // Add an event log when connection state changes
        if (ss.getState() != newSS.getState() ||
                cdmaDataConnectionState != newCdmaDataConnectionState) {
                mDataConnectionState != mNewDataConnectionState) {
            EventLog.writeEvent(EventLogTags.CDMA_SERVICE_STATE_CHANGE,
                    ss.getState(), cdmaDataConnectionState,
                    newSS.getState(), newCdmaDataConnectionState);
                    ss.getState(), mDataConnectionState,
                    newSS.getState(), mNewDataConnectionState);
        }

        ServiceState tss;
@@ -992,7 +989,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
        cellLoc = newCellLoc;
        newCellLoc = tcl;

        cdmaDataConnectionState = newCdmaDataConnectionState;
        mDataConnectionState = mNewDataConnectionState;
        networkType = newNetworkType;
        // this new state has been applied - forget it until we get a new new state
        newNetworkType = 0;
@@ -1175,7 +1172,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
    }


    private int radioTechnologyToDataServiceState(int code) {
    protected int radioTechnologyToDataServiceState(int code) {
        int retVal = ServiceState.STATE_OUT_OF_SERVICE;
        switch(code) {
        case 0:
@@ -1226,14 +1223,14 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
     * ServiceState.RADIO_TECHNOLOGY_UNKNOWN is the same as detached.
     */
    /*package*/ int getCurrentCdmaDataConnectionState() {
        return cdmaDataConnectionState;
        return mDataConnectionState;
    }

    /**
    * TODO: In the future, we need remove getCurrentCdmaDataConnectionState
    */
    public int getCurrentDataConnectionState() {
        return cdmaDataConnectionState;
        return mDataConnectionState;
    }

    /**