Transition to current state after icon timers expire
When the current icon changes temporarily to another state with a timer,
there is a chance that the icon will change again before the transition
completes. This causes NetworkTypeController to preemptively cancel the
transition timer but not update the current state. The race condition
will be fixed in b/233048459, but add a transitionToCurrentState() after
clearing timers to make sure the state is accurate.
Test: atest NetworkTypeControllerTest
Test: manually test basic timer functionality
Bug: 252734651
Change-Id: I260b95ac1c074777d293d387d608596cda4599b1
diff --git a/src/java/com/android/internal/telephony/NetworkTypeController.java b/src/java/com/android/internal/telephony/NetworkTypeController.java
index d27f400..cc2ca64 100644
--- a/src/java/com/android/internal/telephony/NetworkTypeController.java
+++ b/src/java/com/android/internal/telephony/NetworkTypeController.java
@@ -1106,6 +1106,8 @@
removeMessages(EVENT_PRIMARY_TIMER_EXPIRED);
mIsPrimaryTimerActive = false;
mPrimaryTimerState = "";
+ transitionToCurrentState();
+ return;
}
if (mIsSecondaryTimerActive && !mSecondaryTimerState.equals(currentState)) {
@@ -1117,6 +1119,8 @@
removeMessages(EVENT_SECONDARY_TIMER_EXPIRED);
mIsSecondaryTimerActive = false;
mSecondaryTimerState = "";
+ transitionToCurrentState();
+ return;
}
if (mIsPrimaryTimerActive || mIsSecondaryTimerActive) {