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

Commit 4292810f authored by joenchen's avatar joenchen
Browse files

Set mBrightness when needsComposite is zero

When needsComposite is zero in persistBrightness(), the mBrightness
needs to be updated to avoid unexpected skipping.

Bug: 244268674
Test: adb shell cmd device_state state 0 or 1 repeatly
Change-Id: Iccf925c1407e4be489da2dba521b93eee1b1c4b5
parent fad66b2c
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -325,8 +325,10 @@ void DisplayDevice::stageBrightness(float brightness) {
}
}


void DisplayDevice::persistBrightness(bool needsComposite) {
void DisplayDevice::persistBrightness(bool needsComposite) {
    if (needsComposite && mStagedBrightness && mBrightness != *mStagedBrightness) {
    if (mStagedBrightness && mBrightness != *mStagedBrightness) {
        if (needsComposite) {
            getCompositionDisplay()->setNextBrightness(*mStagedBrightness);
            getCompositionDisplay()->setNextBrightness(*mStagedBrightness);
        }
        mBrightness = *mStagedBrightness;
        mBrightness = *mStagedBrightness;
    }
    }
    mStagedBrightness = std::nullopt;
    mStagedBrightness = std::nullopt;