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

Commit 6d735813 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update secondary timestamp" into main

parents a7f18fd5 4b1786fa
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1314,6 +1314,7 @@ public class NetworkTypeController extends StateMachine {
            mRatchetedNrBands.addAll(nrBands);
        } else {
            if (mFeatureFlags.supportNrSaRrcIdle() && mDoesPccListIndicateIdle
                    && anchorNrCellId != mLastAnchorNrCellId
                    && isUsingPhysicalChannelConfigForRrcDetection()
                    && !mPrimaryCellChangedWhileIdle
                    && !isNrAdvancedForPccFields(nrBandwidths, nrBands)) {
@@ -1352,11 +1353,13 @@ public class NetworkTypeController extends StateMachine {
        if (secondaryRule != null) {
            int secondaryDuration = secondaryRule.getSecondaryTimer(mSecondaryTimerState);
            long durationMillis = secondaryDuration * 1000L;
            if ((mSecondaryTimerExpireTimestamp - SystemClock.uptimeMillis()) > durationMillis) {
            long now = SystemClock.uptimeMillis();
            if ((mSecondaryTimerExpireTimestamp - now) > durationMillis) {
                if (DBG) log("Due to PCI change, reduce the secondary timer to " + durationMillis);
                removeMessages(EVENT_SECONDARY_TIMER_EXPIRED);
                sendMessageDelayed(EVENT_SECONDARY_TIMER_EXPIRED, mSecondaryTimerState,
                        durationMillis);
                mSecondaryTimerExpireTimestamp = now + durationMillis;
            }
        } else {
            loge("!! Secondary timer is active, but found no rule for " + mPrimaryTimerState);
+16 −1
Original line number Diff line number Diff line
@@ -1649,8 +1649,23 @@ public class NetworkTypeControllerTest extends TelephonyTest {
                mNetworkTypeController.getOverrideNetworkType());
        assertTrue(mNetworkTypeController.areAnyTimersActive());


        // the timer has been reduced from 20 - 6s(advance band) to 5s(regular). Suppose passed 1s,
        // a new PCC shouldn't affect the timer.
        moveTimeForward(1 * 1000);
        mNetworkTypeController.sendMessage(11 /* EVENT_PHYSICAL_CHANNEL_CONFIGS_CHANGED */,
                new AsyncResult(null, Collections.emptyList(), null));
        mNetworkTypeController.sendMessage(11 /* EVENT_PHYSICAL_CHANNEL_CONFIGS_CHANGED */,
                new AsyncResult(null, List.of(
                        new PhysicalChannelConfig.Builder()
                                .setPhysicalCellId(3)
                                .setNetworkType(TelephonyManager.NETWORK_TYPE_NR)
                                .setCellConnectionStatus(CellInfo.CONNECTION_PRIMARY_SERVING)
                                .build()), null));
        processAllMessages();

        // Verify the timer has been reduced from 20 - 6s(advance band) to 5s(regular).
        moveTimeForward(5 * 1000);
        moveTimeForward(4 * 1000);
        processAllMessages();

        assertEquals("connected_rrc_idle", getCurrentState().getName());