Loading src/java/com/android/internal/telephony/NetworkTypeController.java +5 −0 Original line number Diff line number Diff line Loading @@ -662,6 +662,11 @@ public class NetworkTypeController extends StateMachine { case EVENT_RADIO_OFF_OR_UNAVAILABLE: if (DBG) log("Reset timers since radio is off or unavailable."); resetAllTimers(); mRatchetedNrBands.clear(); mRatchetedNrBandwidths = 0; mLastAnchorNrCellId = PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN; mDoesPccListIndicateIdle = false; mPhysicalChannelConfigs = null; transitionTo(mLegacyState); break; case EVENT_PREFERRED_NETWORK_MODE_CHANGED: Loading tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java +20 −3 Original line number Diff line number Diff line Loading @@ -958,15 +958,32 @@ public class NetworkTypeControllerTest extends TelephonyTest { @Test public void testEventRadioOffOrUnavailable() throws Exception { testTransitionToCurrentStateNrConnected(); assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA, mNetworkTypeController.getOverrideNetworkType()); mBundle.putBoolean(CarrierConfigManager.KEY_RATCHET_NR_ADVANCED_BANDWIDTH_IF_RRC_IDLE_BOOL, true); testTransitionToCurrentStateNrConnectedMmwaveWithAdditionalBandAndNoMmwaveNrNsa(); // Radio off doReturn(NetworkRegistrationInfo.NR_STATE_NONE).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(9 /* EVENT_RADIO_OFF_OR_UNAVAILABLE */); processAllMessages(); assertEquals("legacy", getCurrentState().getName()); assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, mNetworkTypeController.getOverrideNetworkType()); // NR connected: Primary serving NR PCC with cell ID = 1, band = none PhysicalChannelConfig pcc = new PhysicalChannelConfig.Builder() .setNetworkType(TelephonyManager.NETWORK_TYPE_NR) .setPhysicalCellId(1) .setCellConnectionStatus(CellInfo.CONNECTION_PRIMARY_SERVING) .build(); mNetworkTypeController.sendMessage(11 /* EVENT_PHYSICAL_CHANNEL_CONFIGS_CHANGED */, new AsyncResult(null, List.of(pcc), null)); doReturn(NetworkRegistrationInfo.NR_STATE_CONNECTED).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(3 /* EVENT_SERVICE_STATE_CHANGED */); processAllMessages(); assertEquals("connected", getCurrentState().getName()); } @Test Loading Loading
src/java/com/android/internal/telephony/NetworkTypeController.java +5 −0 Original line number Diff line number Diff line Loading @@ -662,6 +662,11 @@ public class NetworkTypeController extends StateMachine { case EVENT_RADIO_OFF_OR_UNAVAILABLE: if (DBG) log("Reset timers since radio is off or unavailable."); resetAllTimers(); mRatchetedNrBands.clear(); mRatchetedNrBandwidths = 0; mLastAnchorNrCellId = PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN; mDoesPccListIndicateIdle = false; mPhysicalChannelConfigs = null; transitionTo(mLegacyState); break; case EVENT_PREFERRED_NETWORK_MODE_CHANGED: Loading
tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java +20 −3 Original line number Diff line number Diff line Loading @@ -958,15 +958,32 @@ public class NetworkTypeControllerTest extends TelephonyTest { @Test public void testEventRadioOffOrUnavailable() throws Exception { testTransitionToCurrentStateNrConnected(); assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA, mNetworkTypeController.getOverrideNetworkType()); mBundle.putBoolean(CarrierConfigManager.KEY_RATCHET_NR_ADVANCED_BANDWIDTH_IF_RRC_IDLE_BOOL, true); testTransitionToCurrentStateNrConnectedMmwaveWithAdditionalBandAndNoMmwaveNrNsa(); // Radio off doReturn(NetworkRegistrationInfo.NR_STATE_NONE).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(9 /* EVENT_RADIO_OFF_OR_UNAVAILABLE */); processAllMessages(); assertEquals("legacy", getCurrentState().getName()); assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, mNetworkTypeController.getOverrideNetworkType()); // NR connected: Primary serving NR PCC with cell ID = 1, band = none PhysicalChannelConfig pcc = new PhysicalChannelConfig.Builder() .setNetworkType(TelephonyManager.NETWORK_TYPE_NR) .setPhysicalCellId(1) .setCellConnectionStatus(CellInfo.CONNECTION_PRIMARY_SERVING) .build(); mNetworkTypeController.sendMessage(11 /* EVENT_PHYSICAL_CHANNEL_CONFIGS_CHANGED */, new AsyncResult(null, List.of(pcc), null)); doReturn(NetworkRegistrationInfo.NR_STATE_CONNECTED).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(3 /* EVENT_SERVICE_STATE_CHANGED */); processAllMessages(); assertEquals("connected", getCurrentState().getName()); } @Test Loading