Merge "Update secondary timestamp" into main
diff --git a/src/java/com/android/internal/telephony/NetworkTypeController.java b/src/java/com/android/internal/telephony/NetworkTypeController.java
index 9b1bd24..6a331cf 100644
--- a/src/java/com/android/internal/telephony/NetworkTypeController.java
+++ b/src/java/com/android/internal/telephony/NetworkTypeController.java
@@ -1314,6 +1314,7 @@
mRatchetedNrBands.addAll(nrBands);
} else {
if (mFeatureFlags.supportNrSaRrcIdle() && mDoesPccListIndicateIdle
+ && anchorNrCellId != mLastAnchorNrCellId
&& isUsingPhysicalChannelConfigForRrcDetection()
&& !mPrimaryCellChangedWhileIdle
&& !isNrAdvancedForPccFields(nrBandwidths, nrBands)) {
@@ -1352,11 +1353,13 @@
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);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java
index 738f765..f92643a 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java
@@ -1649,8 +1649,23 @@
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());