Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +17 −3 Original line number Original line Diff line number Diff line Loading @@ -945,7 +945,7 @@ public class ServiceStateTracker extends Handler { break; break; case EVENT_NETWORK_STATE_CHANGED: case EVENT_NETWORK_STATE_CHANGED: pollState(); modemTriggeredPollState(); break; break; case EVENT_GET_SIGNAL_STRENGTH: case EVENT_GET_SIGNAL_STRENGTH: Loading Loading @@ -2457,6 +2457,18 @@ public class ServiceStateTracker extends Handler { * event has changed * event has changed */ */ public void pollState() { 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 = new int[1]; mPollingContext[0] = 0; mPollingContext[0] = 0; Loading @@ -2476,12 +2488,14 @@ public class ServiceStateTracker extends Handler { setSignalStrengthDefaultValues(); setSignalStrengthDefaultValues(); mGotCountryCode = false; mGotCountryCode = false; mNitzUpdatedTime = 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()) { != mSS.getRilDataRadioTechnology()) { pollStateDone(); pollStateDone(); break; break; } } // else fall through to query for the IWLAN info default: default: // Issue all poll-related commands at once then count down the responses, which // Issue all poll-related commands at once then count down the responses, which Loading src/java/com/android/internal/telephony/test/SimulatedCommands.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -1996,6 +1996,11 @@ public class SimulatedCommands extends BaseCommands mOnRegistrants.notifyRegistrants(); mOnRegistrants.notifyRegistrants(); } } @VisibleForTesting public void notifyVoiceNetworkStateChanged() { mVoiceNetworkStateRegistrants.notifyRegistrants(); } public void setIccCardStatus(IccCardStatus iccCardStatus){ public void setIccCardStatus(IccCardStatus iccCardStatus){ mIccCardStatus = iccCardStatus; mIccCardStatus = iccCardStatus; } } Loading tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -146,6 +146,19 @@ public class ServiceStateTrackerTest extends TelephonyTest { mSimulatedCommands.getGetVoiceRegistrationStateCallCount()); mSimulatedCommands.getGetVoiceRegistrationStateCallCount()); assertEquals(getNetworkSelectionModeCallCount, assertEquals(getNetworkSelectionModeCallCount, mSimulatedCommands.getGetNetworkSelectionModeCallCount()); 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 @Test Loading Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +17 −3 Original line number Original line Diff line number Diff line Loading @@ -945,7 +945,7 @@ public class ServiceStateTracker extends Handler { break; break; case EVENT_NETWORK_STATE_CHANGED: case EVENT_NETWORK_STATE_CHANGED: pollState(); modemTriggeredPollState(); break; break; case EVENT_GET_SIGNAL_STRENGTH: case EVENT_GET_SIGNAL_STRENGTH: Loading Loading @@ -2457,6 +2457,18 @@ public class ServiceStateTracker extends Handler { * event has changed * event has changed */ */ public void pollState() { 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 = new int[1]; mPollingContext[0] = 0; mPollingContext[0] = 0; Loading @@ -2476,12 +2488,14 @@ public class ServiceStateTracker extends Handler { setSignalStrengthDefaultValues(); setSignalStrengthDefaultValues(); mGotCountryCode = false; mGotCountryCode = false; mNitzUpdatedTime = 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()) { != mSS.getRilDataRadioTechnology()) { pollStateDone(); pollStateDone(); break; break; } } // else fall through to query for the IWLAN info default: default: // Issue all poll-related commands at once then count down the responses, which // Issue all poll-related commands at once then count down the responses, which Loading
src/java/com/android/internal/telephony/test/SimulatedCommands.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -1996,6 +1996,11 @@ public class SimulatedCommands extends BaseCommands mOnRegistrants.notifyRegistrants(); mOnRegistrants.notifyRegistrants(); } } @VisibleForTesting public void notifyVoiceNetworkStateChanged() { mVoiceNetworkStateRegistrants.notifyRegistrants(); } public void setIccCardStatus(IccCardStatus iccCardStatus){ public void setIccCardStatus(IccCardStatus iccCardStatus){ mIccCardStatus = iccCardStatus; mIccCardStatus = iccCardStatus; } } Loading
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -146,6 +146,19 @@ public class ServiceStateTrackerTest extends TelephonyTest { mSimulatedCommands.getGetVoiceRegistrationStateCallCount()); mSimulatedCommands.getGetVoiceRegistrationStateCallCount()); assertEquals(getNetworkSelectionModeCallCount, assertEquals(getNetworkSelectionModeCallCount, mSimulatedCommands.getGetNetworkSelectionModeCallCount()); 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 @Test Loading