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

Commit b9e8a7d2 authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Refine pollState when the modem is off.

It had been fixed to not ask the RIL for state if the modem was off
unless we're on IWLAN.  However, the first indication we're on
IWLAN comes via a pollState response.  Modified to also poll
if the pollState trigger came from the RIL (ie, a network state change
notification).

bug:27486486
Change-Id: Ibaed6e2e98d27e651faeeccf71d43e7ff77c938b
parent 446ac70b
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -945,7 +945,7 @@ public class ServiceStateTracker extends Handler {
                break;

            case EVENT_NETWORK_STATE_CHANGED:
                pollState();
                modemTriggeredPollState();
                break;

            case EVENT_GET_SIGNAL_STRENGTH:
@@ -2457,6 +2457,18 @@ public class ServiceStateTracker extends Handler {
     * event has changed
     */
    public void pollState() {
        pollState(false);
    }
    /**
     * We insist on polling even if the radio says its off.
     * Used when we get a network changed notification
     * but the radio is off - part of iwlan hack
     */
    private void modemTriggeredPollState() {
        pollState(true);
    }

    public void pollState(boolean modemTriggered) {
        mPollingContext = new int[1];
        mPollingContext[0] = 0;

@@ -2476,12 +2488,14 @@ public class ServiceStateTracker extends Handler {
                setSignalStrengthDefaultValues();
                mGotCountryCode = false;
                mNitzUpdatedTime = false;
                if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                // don't poll for state when the radio is off
                // EXCEPT, if the poll was modemTrigged (they sent us new radio data)
                // or we're on IWLAN
                if (!modemTriggered && ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                        != mSS.getRilDataRadioTechnology()) {
                    pollStateDone();
                    break;
                }
                // else fall through to query for the IWLAN info

            default:
                // Issue all poll-related commands at once then count down the responses, which
+5 −0
Original line number Diff line number Diff line
@@ -1996,6 +1996,11 @@ public class SimulatedCommands extends BaseCommands
        mOnRegistrants.notifyRegistrants();
    }

    @VisibleForTesting
    public void notifyVoiceNetworkStateChanged() {
        mVoiceNetworkStateRegistrants.notifyRegistrants();
    }

    public void setIccCardStatus(IccCardStatus iccCardStatus){
        mIccCardStatus = iccCardStatus;
    }
+13 −0
Original line number Diff line number Diff line
@@ -146,6 +146,19 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                mSimulatedCommands.getGetVoiceRegistrationStateCallCount());
        assertEquals(getNetworkSelectionModeCallCount,
                mSimulatedCommands.getGetNetworkSelectionModeCallCount());

        // Note that if the poll is triggered by a network change notification
        // and the modem is supposed to be off, we should still do the poll
        mSimulatedCommands.notifyVoiceNetworkStateChanged();
        waitForMs(250);

        assertEquals(getOperatorCallCount + 1 , mSimulatedCommands.getGetOperatorCallCount());
        assertEquals(getDataRegistrationStateCallCount + 1,
                mSimulatedCommands.getGetDataRegistrationStateCallCount());
        assertEquals(getVoiceRegistrationStateCallCount + 1,
                mSimulatedCommands.getGetVoiceRegistrationStateCallCount());
        assertEquals(getNetworkSelectionModeCallCount + 1,
                mSimulatedCommands.getGetNetworkSelectionModeCallCount());
    }

    @Test