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

Commit 24d0b2a1 authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: clamp alpha value instead of error

SF tests expect that invalid alpha values
will be clamped instead of returning failure.

Test: atest SurfaceFlinger_test:SurfaceFlinger_test
Bug: 242117046
Change-Id: I1318f21c21ec9b3fe9577ac3b9f32605e7f7f13a
parent d4cf9f2e
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -1270,13 +1270,10 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setAlpha
        return *this;
    }
    if (alpha < 0.0f || alpha > 1.0f) {
        ALOGE("SurfaceComposerClient::Transaction::setAlpha: invalid alpha %f", alpha);
        mStatus = BAD_VALUE;
        return *this;

        ALOGE("SurfaceComposerClient::Transaction::setAlpha: invalid alpha %f, clamping", alpha);
    }
    s->what |= layer_state_t::eAlphaChanged;
    s->alpha = alpha;
    s->alpha = std::clamp(alpha, 0.f, 1.f);

    registerSurfaceControlForCallback(sc);
    return *this;