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

Commit 43115339 authored by SongFerng Wang's avatar SongFerng Wang Committed by Android (Google) Code Review
Browse files

Merge "when radio capability is without NR, timer should not start." into sc-v2-dev

parents 1a8d6971 c59290bb
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1010,6 +1010,12 @@ public class NetworkTypeController extends StateMachine {
    }

    private void updateTimers() {
        if ((mPhone.getCachedAllowedNetworkTypesBitmask()
                & TelephonyManager.NETWORK_TYPE_BITMASK_NR) == 0) {
            resetAllTimers();
            return;
        }

        String currentState = getCurrentState().getName();

        if (mIsPrimaryTimerActive && getOverrideNetworkType() == getCurrentOverrideNetworkType()) {
+30 −0
Original line number Diff line number Diff line
@@ -918,6 +918,36 @@ public class NetworkTypeControllerTest extends TelephonyTest {
        assertFalse(mNetworkTypeController.is5GHysteresisActive());
    }

    @Test
    public void testPrimaryTimerReset_theNetworkModeWithoutNr() throws Exception {
        doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType();
        doReturn(NetworkRegistrationInfo.NR_STATE_CONNECTED).when(mServiceState).getNrState();
        mBundle.putString(CarrierConfigManager.KEY_5G_ICON_DISPLAY_GRACE_PERIOD_STRING,
                "connected_mmwave,any,10;connected,any,10;not_restricted_rrc_con,any,10");
        broadcastCarrierConfigs();

        assertEquals("connected", getCurrentState().getName());
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA,
                mNetworkTypeController.getOverrideNetworkType());

        // remove NR from preferred network types
        doReturn(RadioAccessFamily.getRafFromNetworkType(
                TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA)).when(
                mPhone).getCachedAllowedNetworkTypesBitmask();

        // trigger 10 second timer after disconnecting from NR, and then it does the timer reset
        // since the network mode without the NR capability.
        doReturn(NetworkRegistrationInfo.NR_STATE_NONE).when(mServiceState).getNrState();
        mNetworkTypeController.sendMessage(EVENT_NR_STATE_CHANGED);
        processAllMessages();

        // timer should be reset.
        assertEquals("legacy", getCurrentState().getName());
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
                mNetworkTypeController.getOverrideNetworkType());
        assertFalse(mNetworkTypeController.is5GHysteresisActive());
    }

    @Test
    public void testPrimaryTimerExpireMmwave() throws Exception {
        doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType();