Check for mIdleTimer instead of fatal log
If there is no idle timer, there should be no action instead of fatal
logging.
Bug: 354616723
Test: atest libsurfaceflinger_unittest
Test: presubmit
Flag: EXEMPT_bugfix
Change-Id: I22bcfdc5c64185b9fc83dc0e8830c8bcfa52756f
diff --git a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
index 9f6eab2..c484df3 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
+++ b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
@@ -1394,13 +1394,14 @@
const auto& idleScreenConfigOpt = getCurrentPolicyLocked()->idleScreenConfigOpt;
if (idleScreenConfigOpt != oldPolicy.idleScreenConfigOpt) {
if (!idleScreenConfigOpt.has_value()) {
- // fallback to legacy timer if existed, otherwise pause the old timer
- LOG_ALWAYS_FATAL_IF(!mIdleTimer);
- if (mConfig.legacyIdleTimerTimeout > 0ms) {
- mIdleTimer->setInterval(mConfig.legacyIdleTimerTimeout);
- mIdleTimer->resume();
- } else {
- mIdleTimer->pause();
+ if (mIdleTimer) {
+ // fallback to legacy timer if existed, otherwise pause the old timer
+ if (mConfig.legacyIdleTimerTimeout > 0ms) {
+ mIdleTimer->setInterval(mConfig.legacyIdleTimerTimeout);
+ mIdleTimer->resume();
+ } else {
+ mIdleTimer->pause();
+ }
}
} else if (idleScreenConfigOpt->timeoutMillis > 0) {
// create a new timer or reconfigure