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

Commit bce49f1e authored by Sarah Chin's avatar Sarah Chin
Browse files

SST set state out of service when radio is off or unavailable

Test: atest ServiceStatetTrackerTest
Bug: 220712223
Change-Id: If5f437641e0850adc6271e507f62fc85fda19257
parent 5ecb8b7d
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -1948,15 +1948,22 @@ public class ServiceStateTracker extends Handler {
                err = ((CommandException)(ar.exception)).getCommandError();
            }

            if (mCi.getRadioState() != TelephonyManager.RADIO_POWER_ON) {
                log("handlePollStateResult: Invalid response due to radio off or unavailable. "
                        + "Set ServiceState to out of service.");
                pollStateInternal(false);
                return;
            }

            if (err == CommandException.Error.RADIO_NOT_AVAILABLE) {
                // Radio has crashed or turned off
                loge("handlePollStateResult: RIL returned RADIO_NOT_AVAILABLE when radio is on.");
                cancelPollState();
                return;
            }

            if (err != CommandException.Error.OP_NOT_ALLOWED_BEFORE_REG_NW) {
                loge("RIL implementation has returned an error where it must succeed" +
                        ar.exception);
                loge("handlePollStateResult: RIL returned an error where it must succeed: "
                        + ar.exception);
            }
        } else try {
            handlePollStateResultMessage(what, ar);
@@ -3328,10 +3335,9 @@ public class ServiceStateTracker extends Handler {

    private void pollStateInternal(boolean modemTriggered) {
        mPollingContext = new int[1];
        mPollingContext[0] = 0;
        NetworkRegistrationInfo nri;

        log("pollState: modemTriggered=" + modemTriggered);
        log("pollState: modemTriggered=" + modemTriggered + ", radioState=" + mCi.getRadioState());

        switch (mCi.getRadioState()) {
            case TelephonyManager.RADIO_POWER_UNAVAILABLE:
@@ -3365,8 +3371,8 @@ public class ServiceStateTracker extends Handler {
                mPhone.getSignalStrengthController().setSignalStrengthDefaultValues();
                mLastNitzData = null;
                mNitzState.handleNetworkUnavailable();
                // don't poll when device is shutting down or the poll was not modemTrigged
                // (they sent us new radio data) and current network is not IWLAN
                // Don't poll when device is shutting down or the poll was not modemTriggered
                // (they sent us new radio data) and the current network is not IWLAN
                if (mDeviceShuttingDown ||
                        (!modemTriggered && ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                        != mSS.getRilDataRadioTechnology())) {