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

Commit 50edf0f7 authored by Rachel Lee's avatar Rachel Lee
Browse files

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
parent fb775d52
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -1394,14 +1394,15 @@ auto RefreshRateSelector::setPolicy(const PolicyVariant& policy) -> SetPolicyRes
        const auto& idleScreenConfigOpt = getCurrentPolicyLocked()->idleScreenConfigOpt;
        if (idleScreenConfigOpt != oldPolicy.idleScreenConfigOpt) {
            if (!idleScreenConfigOpt.has_value()) {
                if (mIdleTimer) {
                    // 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();
                    }
                }
            } else if (idleScreenConfigOpt->timeoutMillis > 0) {
                // create a new timer or reconfigure
                const auto timeout = std::chrono::milliseconds{idleScreenConfigOpt->timeoutMillis};