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

Commit d1591701 authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: fix a bug with DISPLAY_EVENT_MODE_CHANGE

SF might dispatch a DISPLAY_EVENT_MODE_CHANGE event before changing
the actual mode. This can happen when the mode change takes more than
a single refresh and caused by incorrectly checking the previously
reported event without checking for the current mode.

Bug: 194515308
Bug: 193945763
Test: SF unit tests
Change-Id: Icf44e0fb6aadb76e629cd408907389e2626d2047
parent ad494f0a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -395,6 +395,14 @@ void Scheduler::dispatchCachedReportedMode() {
        return;
    }

    // If the mode is not the current mode, this means that a
    // mode change is in progress. In that case we shouldn't dispatch an event
    // as it will be dispatched when the current mode changes.
    if (std::scoped_lock lock(mRefreshRateConfigsLock);
        mRefreshRateConfigs->getCurrentRefreshRate().getMode() != mFeatures.mode) {
        return;
    }

    // If there is no change from cached mode, there is no need to dispatch an event
    if (mFeatures.mode == mFeatures.cachedModeChangedParams->mode) {
        return;