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

Commit cc96c24f authored by Ling Ma's avatar Ling Ma Committed by Android (Google) Code Review
Browse files

Merge "Clear cache upon radio off or unavailable" into main

parents 7358e7f8 214fea45
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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:
+20 −3
Original line number Diff line number Diff line
@@ -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