aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/android/internal/telephony
diff options
context:
space:
mode:
authorLing Ma <linggm@google.com>2024-03-01 04:21:00 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2024-03-01 04:21:00 +0000
commitbb8e7f93bd0f4483a1a65dcf03c76db153d93b01 (patch)
treeceee1821b62888d9a03c86ad9317d138084f6739 /src/java/com/android/internal/telephony
parentc1f817e358a93b5b7f9dbb3899df5e6f36e0ca7e (diff)
parent01baee6f8d003af8f0fcb9db3ce5662c3a5c4d18 (diff)
downloadtelephony-bb8e7f93bd0f4483a1a65dcf03c76db153d93b01.tar.gz
Merge "Reduce Advance band timer when PCI changes" into main
Diffstat (limited to 'src/java/com/android/internal/telephony')
-rw-r--r--src/java/com/android/internal/telephony/NetworkTypeController.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/java/com/android/internal/telephony/NetworkTypeController.java b/src/java/com/android/internal/telephony/NetworkTypeController.java
index 68d24a275d..67ca1e1aaf 100644
--- a/src/java/com/android/internal/telephony/NetworkTypeController.java
+++ b/src/java/com/android/internal/telephony/NetworkTypeController.java
@@ -26,6 +26,7 @@ import android.os.AsyncResult;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.PowerManager;
+import android.os.SystemClock;
import android.telephony.AccessNetworkConstants;
import android.telephony.Annotation;
import android.telephony.CarrierConfigManager;
@@ -194,6 +195,7 @@ public class NetworkTypeController extends StateMachine {
private boolean mIsPhysicalChannelConfigOn;
private boolean mIsPrimaryTimerActive;
private boolean mIsSecondaryTimerActive;
+ private long mSecondaryTimerExpireTimestamp;
private boolean mIsTimerResetEnabledForLegacyStateRrcIdle;
/** Carrier config to reset timers when mccmnc changes */
private boolean mIsTimerResetEnabledOnPlmnChanges;
@@ -220,6 +222,7 @@ public class NetworkTypeController extends StateMachine {
// Cached copies below to prevent race conditions
@NonNull private ServiceState mServiceState;
+ /** Used to track link status to be DORMANT or ACTIVE */
@Nullable private List<PhysicalChannelConfig> mPhysicalChannelConfigs;
// Ratchet physical channel config fields to prevent 5G/5G+ flickering
@@ -666,6 +669,7 @@ public class NetworkTypeController extends StateMachine {
case EVENT_SECONDARY_TIMER_EXPIRED:
if (DBG) log("Secondary timer expired for state: " + mSecondaryTimerState);
mIsSecondaryTimerActive = false;
+ mSecondaryTimerExpireTimestamp = 0;
mSecondaryTimerState = "";
updateTimers();
mLastShownNrDueToAdvancedBand = false;
@@ -1251,6 +1255,8 @@ public class NetworkTypeController extends StateMachine {
private void updatePhysicalChannelConfigs(List<PhysicalChannelConfig> physicalChannelConfigs) {
boolean isPccListEmpty = physicalChannelConfigs == null || physicalChannelConfigs.isEmpty();
if (isPccListEmpty && isUsingPhysicalChannelConfigForRrcDetection()) {
+ // Clear mPrimaryCellChangedWhileIdle to allow later potential one-off PCI change.
+ // Update link status to be DORMANT, but keep ratcheted bands.
log("Physical channel configs updated: not updating PCC fields for empty PCC list "
+ "indicating RRC idle.");
mPrimaryCellChangedWhileIdle = false;
@@ -1310,6 +1316,7 @@ public class NetworkTypeController extends StateMachine {
+ mLastAnchorNrCellId + " -> " + anchorNrCellId);
mPrimaryCellChangedWhileIdle = true;
mLastAnchorNrCellId = anchorNrCellId;
+ reduceSecondaryTimerIfNeeded();
return;
}
if (mRatchetPccFieldsForSameAnchorNrCell) {
@@ -1330,6 +1337,27 @@ public class NetworkTypeController extends StateMachine {
}
}
+ /**
+ * Called when PCI change, specifically during idle state.
+ */
+ private void reduceSecondaryTimerIfNeeded() {
+ if (!mIsSecondaryTimerActive || mNrAdvancedBandsSecondaryTimer <= 0) return;
+ // Secondary timer is active, so we must have a valid secondary rule right now.
+ OverrideTimerRule secondaryRule = mOverrideTimerRules.get(mPrimaryTimerState);
+ if (secondaryRule != null) {
+ int secondaryDuration = secondaryRule.getSecondaryTimer(mSecondaryTimerState);
+ long durationMillis = secondaryDuration * 1000L;
+ if ((mSecondaryTimerExpireTimestamp - SystemClock.uptimeMillis()) > 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);
+ }
+ } else {
+ loge("!! Secondary timer is active, but found no rule for " + mPrimaryTimerState);
+ }
+ }
+
private void transitionWithTimerTo(IState destState) {
String destName = destState.getName();
if (mIsPrimaryTimerActive) {
@@ -1369,7 +1397,9 @@ public class NetworkTypeController extends StateMachine {
mSecondaryTimerState = currentName;
mPreviousState = currentName;
mIsSecondaryTimerActive = true;
- sendMessageDelayed(EVENT_SECONDARY_TIMER_EXPIRED, destState, duration * 1000L);
+ long durationMillis = duration * 1000L;
+ mSecondaryTimerExpireTimestamp = SystemClock.uptimeMillis() + durationMillis;
+ sendMessageDelayed(EVENT_SECONDARY_TIMER_EXPIRED, destState, durationMillis);
}
mIsPrimaryTimerActive = false;
transitionTo(getCurrentState());
@@ -1434,6 +1464,7 @@ public class NetworkTypeController extends StateMachine {
}
removeMessages(EVENT_SECONDARY_TIMER_EXPIRED);
mIsSecondaryTimerActive = false;
+ mSecondaryTimerExpireTimestamp = 0;
mSecondaryTimerState = "";
transitionToCurrentState();
return;
@@ -1464,6 +1495,7 @@ public class NetworkTypeController extends StateMachine {
removeMessages(EVENT_SECONDARY_TIMER_EXPIRED);
mIsPrimaryTimerActive = false;
mIsSecondaryTimerActive = false;
+ mSecondaryTimerExpireTimestamp = 0;
mPrimaryTimerState = "";
mSecondaryTimerState = "";