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

Commit f1317a4b authored by Wink Saville's avatar Wink Saville
Browse files

On data only devices use data registration state.

Some operators may report that the voice registration state is
not in service on a data only device. So use the Data registration
state for data only devices.

Bug: 8213254
Change-Id: Ieb6eef65fa5afb3d2c1a39b32a5bc5825ccc7f1c
parent 66c86c83
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ public abstract class ServiceStateTracker extends Handler {

    protected PhoneBase mPhoneBase;

    protected boolean mVoiceCapable;

    public ServiceState mSS = new ServiceState();
    protected ServiceState mNewSS = new ServiceState();

@@ -196,6 +198,8 @@ public abstract class ServiceStateTracker extends Handler {
        mPhoneBase = phoneBase;
        mCellInfo = cellInfo;
        mCi = ci;
        mVoiceCapable = mPhoneBase.getContext().getResources().getBoolean(
                com.android.internal.R.bool.config_voice_capable);
        mUiccController = UiccController.getInstance();
        mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null);
        mCi.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null);
@@ -229,6 +233,22 @@ public abstract class ServiceStateTracker extends Handler {
        return notified;
    }

    /**
     * Some operators have been known to report registration failure
     * data only devices, to fix that use DataRegState.
     */
    protected void useDataRegStateForDataOnlyDevices() {
        if (mVoiceCapable == false) {
            if (DBG) {
                log("useDataRegStateForDataOnlyDevice: VoiceRegState=" + mNewSS.getVoiceRegState()
                    + " DataRegState=" + mNewSS.getDataRegState());
            }
            // TODO: Consider not lying and instead have callers know the difference. 
            mNewSS.setVoiceRegState(mNewSS.getDataRegState());
        }
    }


    /**
     * Registration point for combined roaming on
     * combined roaming is true when roaming is true and ONS differs SPN
+2 −0
Original line number Diff line number Diff line
@@ -251,6 +251,8 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
    protected void pollStateDone() {
        log("pollStateDone: lte 1 ss=[" + mSS + "] newSS=[" + mNewSS + "]");

        useDataRegStateForDataOnlyDevices();

        boolean hasRegistered = mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
                && mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;

+2 −0
Original line number Diff line number Diff line
@@ -964,6 +964,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            mNewSS.setRoaming(true);
        }

        useDataRegStateForDataOnlyDevices();

        boolean hasRegistered =
            mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
            && mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;
+2 −0
Original line number Diff line number Diff line
@@ -806,6 +806,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
            mNewSS.setRoaming(true);
        }

        useDataRegStateForDataOnlyDevices();

        boolean hasRegistered =
            mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
            && mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;