Loading src/java/com/android/internal/telephony/NetworkTypeController.java +17 −5 Original line number Diff line number Diff line Loading @@ -150,6 +150,7 @@ public class NetworkTypeController extends StateMachine { private boolean mIsPhysicalChannelConfig16Supported; private Boolean mIsNrAdvancedAllowedByPco = false; private int mNrAdvancedCapablePcoId = 0; private boolean mIsUsingUserDataForRrcDetection = false; /** * NetworkTypeController constructor. Loading Loading @@ -279,6 +280,13 @@ public class NetworkTypeController extends StateMachine { CarrierConfigManager.KEY_ADDITIONAL_NR_ADVANCED_BANDS_INT_ARRAY); mNrAdvancedCapablePcoId = b.getInt( CarrierConfigManager.KEY_NR_ADVANCED_CAPABLE_PCO_ID_INT); mIsUsingUserDataForRrcDetection = b.getBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL); if (mIsPhysicalChannelConfig16Supported && mIsUsingUserDataForRrcDetection) { mPhone.getDcTracker(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .registerForPhysicalLinkStateChanged(getHandler(), EVENT_PHYSICAL_LINK_STATE_CHANGED); } } } createTimerRules(nrIconConfiguration, overrideTimerRule, overrideSecondaryTimerRule); Loading Loading @@ -503,7 +511,7 @@ public class NetworkTypeController extends StateMachine { // ignored break; case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); } break; Loading Loading @@ -608,7 +616,7 @@ public class NetworkTypeController extends StateMachine { // ignored break; case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); if (mIsTimerResetEnabledForLegacyStateRRCIdle && !isPhysicalLinkActive()) { resetAllTimers(); Loading Loading @@ -680,7 +688,7 @@ public class NetworkTypeController extends StateMachine { // ignore break; case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); if (isNrNotRestricted()) { // NOT_RESTRICTED_RRC_IDLE -> NOT_RESTRICTED_RRC_CON Loading Loading @@ -764,7 +772,7 @@ public class NetworkTypeController extends StateMachine { // ignore break; case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); if (isNrNotRestricted()) { // NOT_RESTRICTED_RRC_CON -> NOT_RESTRICTED_RRC_IDLE Loading Loading @@ -856,7 +864,7 @@ public class NetworkTypeController extends StateMachine { break; case EVENT_NR_FREQUENCY_CHANGED: case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); } updateNrAdvancedState(); Loading Loading @@ -1188,6 +1196,10 @@ public class NetworkTypeController extends StateMachine { } } private boolean isUsingPhysicalChannelConfigForRrcDetection() { return mIsPhysicalChannelConfig16Supported && !mIsUsingUserDataForRrcDetection; } protected void log(String s) { Rlog.d(TAG, "[" + mPhone.getPhoneId() + "] " + s); } Loading tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java +88 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,27 @@ public class NetworkTypeControllerTest extends TelephonyTest { assertEquals("not_restricted_rrc_idle", getCurrentState().getName()); } @Test public void testTransitionToCurrentStateIdle_usingUserDataForRrcDetection() throws Exception { mBundle.putBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL, true); doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); assertEquals("DefaultState", getCurrentState().getName()); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(EVENT_PHYSICAL_LINK_STATE_CHANGED, new AsyncResult(null, DcController.PHYSICAL_LINK_NOT_ACTIVE, null)); mNetworkTypeController.sendMessage(NetworkTypeController.EVENT_UPDATE); processAllMessages(); assertEquals("not_restricted_rrc_idle", getCurrentState().getName()); } @Test public void testTransitionToCurrentStateLteConnected() throws Exception { assertEquals("DefaultState", getCurrentState().getName()); Loading @@ -319,6 +340,7 @@ public class NetworkTypeControllerTest extends TelephonyTest { doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); assertEquals("DefaultState", getCurrentState().getName()); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); Loading @@ -330,6 +352,28 @@ public class NetworkTypeControllerTest extends TelephonyTest { assertEquals("not_restricted_rrc_con", getCurrentState().getName()); } @Test public void testTransitionToCurrentStateLteConnected_usingUserDataForRrcDetection() throws Exception { mBundle.putBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL, true); doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); assertEquals("DefaultState", getCurrentState().getName()); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(EVENT_PHYSICAL_LINK_STATE_CHANGED, new AsyncResult(null, DcController.PHYSICAL_LINK_ACTIVE, null)); mNetworkTypeController.sendMessage(NetworkTypeController.EVENT_UPDATE); processAllMessages(); assertEquals("not_restricted_rrc_con", getCurrentState().getName()); } @Test public void testTransitionToCurrentStateNrConnected() throws Exception { assertEquals("DefaultState", getCurrentState().getName()); Loading Loading @@ -564,6 +608,30 @@ public class NetworkTypeControllerTest extends TelephonyTest { assertEquals("not_restricted_rrc_con", getCurrentState().getName()); } @Test public void testUsingUserDataForRrcDetection_FromNrConnectedMmwaveToLteConnected() throws Exception { mBundle.putBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL, true); doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); testTransitionToCurrentStateNrConnectedMmwave(); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(EVENT_PHYSICAL_LINK_STATE_CHANGED, new AsyncResult(null, DcController.PHYSICAL_LINK_ACTIVE, null)); mNetworkTypeController.sendMessage(EVENT_NR_FREQUENCY_CHANGED); mNetworkTypeController.sendMessage(EVENT_NR_STATE_CHANGED); processAllMessages(); assertEquals("not_restricted_rrc_con", getCurrentState().getName()); } @Test public void testEventPhysicalChannelChangeFromLteToLteCaInLegacyState() throws Exception { testTransitionToCurrentStateLegacy(); Loading Loading @@ -668,6 +736,26 @@ public class NetworkTypeControllerTest extends TelephonyTest { assertEquals("not_restricted_rrc_idle", getCurrentState().getName()); } @Test public void testEventPhysicalLinkStateChanged_UsingUserDataForRrcDetection() throws Exception { mBundle.putBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL, true); doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); testTransitionToCurrentStateLteConnected_usingUserDataForRrcDetection(); doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(mServiceState).getNrFrequencyRange(); mNetworkTypeController.sendMessage(EVENT_PHYSICAL_LINK_STATE_CHANGED, new AsyncResult(null, DcController.PHYSICAL_LINK_NOT_ACTIVE, null)); processAllMessages(); assertEquals("not_restricted_rrc_idle", getCurrentState().getName()); } @Test public void testEventPhysicalChannelConfigNotifChanged() throws Exception { testTransitionToCurrentStateNrConnected(); Loading Loading
src/java/com/android/internal/telephony/NetworkTypeController.java +17 −5 Original line number Diff line number Diff line Loading @@ -150,6 +150,7 @@ public class NetworkTypeController extends StateMachine { private boolean mIsPhysicalChannelConfig16Supported; private Boolean mIsNrAdvancedAllowedByPco = false; private int mNrAdvancedCapablePcoId = 0; private boolean mIsUsingUserDataForRrcDetection = false; /** * NetworkTypeController constructor. Loading Loading @@ -279,6 +280,13 @@ public class NetworkTypeController extends StateMachine { CarrierConfigManager.KEY_ADDITIONAL_NR_ADVANCED_BANDS_INT_ARRAY); mNrAdvancedCapablePcoId = b.getInt( CarrierConfigManager.KEY_NR_ADVANCED_CAPABLE_PCO_ID_INT); mIsUsingUserDataForRrcDetection = b.getBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL); if (mIsPhysicalChannelConfig16Supported && mIsUsingUserDataForRrcDetection) { mPhone.getDcTracker(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .registerForPhysicalLinkStateChanged(getHandler(), EVENT_PHYSICAL_LINK_STATE_CHANGED); } } } createTimerRules(nrIconConfiguration, overrideTimerRule, overrideSecondaryTimerRule); Loading Loading @@ -503,7 +511,7 @@ public class NetworkTypeController extends StateMachine { // ignored break; case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); } break; Loading Loading @@ -608,7 +616,7 @@ public class NetworkTypeController extends StateMachine { // ignored break; case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); if (mIsTimerResetEnabledForLegacyStateRRCIdle && !isPhysicalLinkActive()) { resetAllTimers(); Loading Loading @@ -680,7 +688,7 @@ public class NetworkTypeController extends StateMachine { // ignore break; case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); if (isNrNotRestricted()) { // NOT_RESTRICTED_RRC_IDLE -> NOT_RESTRICTED_RRC_CON Loading Loading @@ -764,7 +772,7 @@ public class NetworkTypeController extends StateMachine { // ignore break; case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); if (isNrNotRestricted()) { // NOT_RESTRICTED_RRC_CON -> NOT_RESTRICTED_RRC_IDLE Loading Loading @@ -856,7 +864,7 @@ public class NetworkTypeController extends StateMachine { break; case EVENT_NR_FREQUENCY_CHANGED: case EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED: if (mIsPhysicalChannelConfig16Supported) { if (isUsingPhysicalChannelConfigForRrcDetection()) { mPhysicalLinkState = getPhysicalLinkStateFromPhysicalChannelConfig(); } updateNrAdvancedState(); Loading Loading @@ -1188,6 +1196,10 @@ public class NetworkTypeController extends StateMachine { } } private boolean isUsingPhysicalChannelConfigForRrcDetection() { return mIsPhysicalChannelConfig16Supported && !mIsUsingUserDataForRrcDetection; } protected void log(String s) { Rlog.d(TAG, "[" + mPhone.getPhoneId() + "] " + s); } Loading
tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java +88 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,27 @@ public class NetworkTypeControllerTest extends TelephonyTest { assertEquals("not_restricted_rrc_idle", getCurrentState().getName()); } @Test public void testTransitionToCurrentStateIdle_usingUserDataForRrcDetection() throws Exception { mBundle.putBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL, true); doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); assertEquals("DefaultState", getCurrentState().getName()); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(EVENT_PHYSICAL_LINK_STATE_CHANGED, new AsyncResult(null, DcController.PHYSICAL_LINK_NOT_ACTIVE, null)); mNetworkTypeController.sendMessage(NetworkTypeController.EVENT_UPDATE); processAllMessages(); assertEquals("not_restricted_rrc_idle", getCurrentState().getName()); } @Test public void testTransitionToCurrentStateLteConnected() throws Exception { assertEquals("DefaultState", getCurrentState().getName()); Loading @@ -319,6 +340,7 @@ public class NetworkTypeControllerTest extends TelephonyTest { doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); assertEquals("DefaultState", getCurrentState().getName()); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); Loading @@ -330,6 +352,28 @@ public class NetworkTypeControllerTest extends TelephonyTest { assertEquals("not_restricted_rrc_con", getCurrentState().getName()); } @Test public void testTransitionToCurrentStateLteConnected_usingUserDataForRrcDetection() throws Exception { mBundle.putBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL, true); doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); assertEquals("DefaultState", getCurrentState().getName()); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(EVENT_PHYSICAL_LINK_STATE_CHANGED, new AsyncResult(null, DcController.PHYSICAL_LINK_ACTIVE, null)); mNetworkTypeController.sendMessage(NetworkTypeController.EVENT_UPDATE); processAllMessages(); assertEquals("not_restricted_rrc_con", getCurrentState().getName()); } @Test public void testTransitionToCurrentStateNrConnected() throws Exception { assertEquals("DefaultState", getCurrentState().getName()); Loading Loading @@ -564,6 +608,30 @@ public class NetworkTypeControllerTest extends TelephonyTest { assertEquals("not_restricted_rrc_con", getCurrentState().getName()); } @Test public void testUsingUserDataForRrcDetection_FromNrConnectedMmwaveToLteConnected() throws Exception { mBundle.putBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL, true); doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); testTransitionToCurrentStateNrConnectedMmwave(); doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType(); doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(mServiceState).getNrState(); mNetworkTypeController.sendMessage(EVENT_PHYSICAL_LINK_STATE_CHANGED, new AsyncResult(null, DcController.PHYSICAL_LINK_ACTIVE, null)); mNetworkTypeController.sendMessage(EVENT_NR_FREQUENCY_CHANGED); mNetworkTypeController.sendMessage(EVENT_NR_STATE_CHANGED); processAllMessages(); assertEquals("not_restricted_rrc_con", getCurrentState().getName()); } @Test public void testEventPhysicalChannelChangeFromLteToLteCaInLegacyState() throws Exception { testTransitionToCurrentStateLegacy(); Loading Loading @@ -668,6 +736,26 @@ public class NetworkTypeControllerTest extends TelephonyTest { assertEquals("not_restricted_rrc_idle", getCurrentState().getName()); } @Test public void testEventPhysicalLinkStateChanged_UsingUserDataForRrcDetection() throws Exception { mBundle.putBoolean( CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL, true); doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported( TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED); mNetworkTypeController = new NetworkTypeController(mPhone, mDisplayInfoController); broadcastCarrierConfigs(); processAllMessages(); testTransitionToCurrentStateLteConnected_usingUserDataForRrcDetection(); doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(mServiceState).getNrFrequencyRange(); mNetworkTypeController.sendMessage(EVENT_PHYSICAL_LINK_STATE_CHANGED, new AsyncResult(null, DcController.PHYSICAL_LINK_NOT_ACTIVE, null)); processAllMessages(); assertEquals("not_restricted_rrc_idle", getCurrentState().getName()); } @Test public void testEventPhysicalChannelConfigNotifChanged() throws Exception { testTransitionToCurrentStateNrConnected(); Loading