Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +4 −2 Original line number Diff line number Diff line Loading @@ -2492,12 +2492,13 @@ public class ServiceStateTracker extends Handler { if (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 // are allowed to arrive out-of-order mPollingContext[0]++; mCi.getOperator(obtainMessage(EVENT_POLL_STATE_OPERATOR, mPollingContext)); Loading Loading @@ -4587,7 +4588,8 @@ public class ServiceStateTracker extends Handler { pw.println(" mCellInfo=" + mCellInfo); pw.println(" mCellInfoLte=" + mCellInfoLte); pw.println(" mRestrictedState=" + mRestrictedState); pw.println(" mPollingContext=" + mPollingContext); pw.println(" mPollingContext=" + mPollingContext + " - " + (mPollingContext != null ? mPollingContext[0] : "")); pw.println(" mDesiredPowerState=" + mDesiredPowerState); pw.println(" mDontPollSignalStrength=" + mDontPollSignalStrength); pw.println(" mSignalStrength=" + mSignalStrength); Loading src/java/com/android/internal/telephony/test/SimulatedCommands.java +34 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.internal.telephony.uicc.IccIoResult; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; public class SimulatedCommands extends BaseCommands implements CommandsInterface, SimulatedRadioControl { Loading Loading @@ -119,7 +120,6 @@ public class SimulatedCommands extends BaseCommands private DataCallResponse mDcResponse; //***** Constructor public SimulatedCommands() { super(null); // Don't log statistics Loading Loading @@ -954,6 +954,7 @@ public class SimulatedCommands extends BaseCommands */ @Override public void getVoiceRegistrationState(Message result) { mGetVoiceRegistrationStateCallCount.incrementAndGet(); String ret[] = new String[14]; ret[0] = Integer.toString(mVoiceRegState); Loading @@ -962,6 +963,13 @@ public class SimulatedCommands extends BaseCommands resultSuccess(result, ret); } private final AtomicInteger mGetVoiceRegistrationStateCallCount = new AtomicInteger(0); @VisibleForTesting public int getGetVoiceRegistrationStateCallCount() { return mGetVoiceRegistrationStateCallCount.get(); } public void setDataRadioTech(int radioTech) { mDataRadioTech = radioTech; } Loading @@ -972,6 +980,7 @@ public class SimulatedCommands extends BaseCommands @Override public void getDataRegistrationState (Message result) { mGetDataRegistrationStateCallCount.incrementAndGet(); String ret[] = new String[11]; ret[0] = Integer.toString(mDataRegState); Loading @@ -980,6 +989,13 @@ public class SimulatedCommands extends BaseCommands resultSuccess(result, ret); } private final AtomicInteger mGetDataRegistrationStateCallCount = new AtomicInteger(0); @VisibleForTesting public int getGetDataRegistrationStateCallCount() { return mGetDataRegistrationStateCallCount.get(); } /** * response.obj.result is a String[3] * response.obj.result[0] is long alpha or null if unregistered Loading @@ -988,6 +1004,7 @@ public class SimulatedCommands extends BaseCommands */ @Override public void getOperator(Message result) { mGetOperatorCallCount.incrementAndGet(); String[] ret = new String[3]; ret[0] = FAKE_LONG_NAME; Loading @@ -997,6 +1014,14 @@ public class SimulatedCommands extends BaseCommands resultSuccess(result, ret); } private final AtomicInteger mGetOperatorCallCount = new AtomicInteger(0); @VisibleForTesting public int getGetOperatorCallCount() { final int count = mGetOperatorCallCount.get(); return mGetOperatorCallCount.get(); } /** * ar.exception carries exception on failure * ar.userObject contains the original value of result.obj Loading Loading @@ -1337,12 +1362,20 @@ public class SimulatedCommands extends BaseCommands @Override public void getNetworkSelectionMode(Message result) { SimulatedCommandsVerifier.getInstance().getNetworkSelectionMode(result); getNetworkSelectionModeCallCount.incrementAndGet(); int ret[] = new int[1]; ret[0] = 0; resultSuccess(result, ret); } private final AtomicInteger getNetworkSelectionModeCallCount = new AtomicInteger(0); @VisibleForTesting public int getGetNetworkSelectionModeCallCount() { return getNetworkSelectionModeCallCount.get(); } /** * Queries the currently available networks * Loading tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +26 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,32 @@ public class ServiceStateTrackerTest extends TelephonyTest { assertTrue(oldState != mSimulatedCommands.getRadioState().isOn()); } @Test @MediumTest public void testNoRilTrafficAfterSetRadioPower() { sst.setRadioPower(true); final int getOperatorCallCount = mSimulatedCommands.getGetOperatorCallCount(); final int getDataRegistrationStateCallCount = mSimulatedCommands.getGetDataRegistrationStateCallCount(); final int getVoiceRegistrationStateCallCount = mSimulatedCommands.getGetVoiceRegistrationStateCallCount(); final int getNetworkSelectionModeCallCount = mSimulatedCommands.getGetNetworkSelectionModeCallCount(); sst.setRadioPower(false); waitForMs(500); sst.pollState(); waitForMs(250); assertEquals(getOperatorCallCount, mSimulatedCommands.getGetOperatorCallCount()); assertEquals(getDataRegistrationStateCallCount, mSimulatedCommands.getGetDataRegistrationStateCallCount()); assertEquals(getVoiceRegistrationStateCallCount, mSimulatedCommands.getGetVoiceRegistrationStateCallCount()); assertEquals(getNetworkSelectionModeCallCount, mSimulatedCommands.getGetNetworkSelectionModeCallCount()); } @Test @MediumTest public void testSpnUpdateShowPlmnOnly() { Loading Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +4 −2 Original line number Diff line number Diff line Loading @@ -2492,12 +2492,13 @@ public class ServiceStateTracker extends Handler { if (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 // are allowed to arrive out-of-order mPollingContext[0]++; mCi.getOperator(obtainMessage(EVENT_POLL_STATE_OPERATOR, mPollingContext)); Loading Loading @@ -4587,7 +4588,8 @@ public class ServiceStateTracker extends Handler { pw.println(" mCellInfo=" + mCellInfo); pw.println(" mCellInfoLte=" + mCellInfoLte); pw.println(" mRestrictedState=" + mRestrictedState); pw.println(" mPollingContext=" + mPollingContext); pw.println(" mPollingContext=" + mPollingContext + " - " + (mPollingContext != null ? mPollingContext[0] : "")); pw.println(" mDesiredPowerState=" + mDesiredPowerState); pw.println(" mDontPollSignalStrength=" + mDontPollSignalStrength); pw.println(" mSignalStrength=" + mSignalStrength); Loading
src/java/com/android/internal/telephony/test/SimulatedCommands.java +34 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.internal.telephony.uicc.IccIoResult; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; public class SimulatedCommands extends BaseCommands implements CommandsInterface, SimulatedRadioControl { Loading Loading @@ -119,7 +120,6 @@ public class SimulatedCommands extends BaseCommands private DataCallResponse mDcResponse; //***** Constructor public SimulatedCommands() { super(null); // Don't log statistics Loading Loading @@ -954,6 +954,7 @@ public class SimulatedCommands extends BaseCommands */ @Override public void getVoiceRegistrationState(Message result) { mGetVoiceRegistrationStateCallCount.incrementAndGet(); String ret[] = new String[14]; ret[0] = Integer.toString(mVoiceRegState); Loading @@ -962,6 +963,13 @@ public class SimulatedCommands extends BaseCommands resultSuccess(result, ret); } private final AtomicInteger mGetVoiceRegistrationStateCallCount = new AtomicInteger(0); @VisibleForTesting public int getGetVoiceRegistrationStateCallCount() { return mGetVoiceRegistrationStateCallCount.get(); } public void setDataRadioTech(int radioTech) { mDataRadioTech = radioTech; } Loading @@ -972,6 +980,7 @@ public class SimulatedCommands extends BaseCommands @Override public void getDataRegistrationState (Message result) { mGetDataRegistrationStateCallCount.incrementAndGet(); String ret[] = new String[11]; ret[0] = Integer.toString(mDataRegState); Loading @@ -980,6 +989,13 @@ public class SimulatedCommands extends BaseCommands resultSuccess(result, ret); } private final AtomicInteger mGetDataRegistrationStateCallCount = new AtomicInteger(0); @VisibleForTesting public int getGetDataRegistrationStateCallCount() { return mGetDataRegistrationStateCallCount.get(); } /** * response.obj.result is a String[3] * response.obj.result[0] is long alpha or null if unregistered Loading @@ -988,6 +1004,7 @@ public class SimulatedCommands extends BaseCommands */ @Override public void getOperator(Message result) { mGetOperatorCallCount.incrementAndGet(); String[] ret = new String[3]; ret[0] = FAKE_LONG_NAME; Loading @@ -997,6 +1014,14 @@ public class SimulatedCommands extends BaseCommands resultSuccess(result, ret); } private final AtomicInteger mGetOperatorCallCount = new AtomicInteger(0); @VisibleForTesting public int getGetOperatorCallCount() { final int count = mGetOperatorCallCount.get(); return mGetOperatorCallCount.get(); } /** * ar.exception carries exception on failure * ar.userObject contains the original value of result.obj Loading Loading @@ -1337,12 +1362,20 @@ public class SimulatedCommands extends BaseCommands @Override public void getNetworkSelectionMode(Message result) { SimulatedCommandsVerifier.getInstance().getNetworkSelectionMode(result); getNetworkSelectionModeCallCount.incrementAndGet(); int ret[] = new int[1]; ret[0] = 0; resultSuccess(result, ret); } private final AtomicInteger getNetworkSelectionModeCallCount = new AtomicInteger(0); @VisibleForTesting public int getGetNetworkSelectionModeCallCount() { return getNetworkSelectionModeCallCount.get(); } /** * Queries the currently available networks * Loading
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +26 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,32 @@ public class ServiceStateTrackerTest extends TelephonyTest { assertTrue(oldState != mSimulatedCommands.getRadioState().isOn()); } @Test @MediumTest public void testNoRilTrafficAfterSetRadioPower() { sst.setRadioPower(true); final int getOperatorCallCount = mSimulatedCommands.getGetOperatorCallCount(); final int getDataRegistrationStateCallCount = mSimulatedCommands.getGetDataRegistrationStateCallCount(); final int getVoiceRegistrationStateCallCount = mSimulatedCommands.getGetVoiceRegistrationStateCallCount(); final int getNetworkSelectionModeCallCount = mSimulatedCommands.getGetNetworkSelectionModeCallCount(); sst.setRadioPower(false); waitForMs(500); sst.pollState(); waitForMs(250); assertEquals(getOperatorCallCount, mSimulatedCommands.getGetOperatorCallCount()); assertEquals(getDataRegistrationStateCallCount, mSimulatedCommands.getGetDataRegistrationStateCallCount()); assertEquals(getVoiceRegistrationStateCallCount, mSimulatedCommands.getGetVoiceRegistrationStateCallCount()); assertEquals(getNetworkSelectionModeCallCount, mSimulatedCommands.getGetNetworkSelectionModeCallCount()); } @Test @MediumTest public void testSpnUpdateShowPlmnOnly() { Loading