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

Commit 996bc421 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Properly merge flags when merging transactions

Test: atest SurfaceFlinger_test

Change-Id: Ib1446c5afe00fd2588f7682f33cbbc6d6eb6a1ea
parent f9f627bf
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -267,8 +267,9 @@ void layer_state_t::merge(const layer_state_t& other) {
    }
    if (other.what & eFlagsChanged) {
        what |= eFlagsChanged;
        flags = other.flags;
        mask = other.mask;
        flags &= ~other.mask;
        flags |= (other.flags & other.mask);
        mask |= other.mask;
    }
    if (other.what & eLayerStackChanged) {
        what |= eLayerStackChanged;
+24 −0
Original line number Diff line number Diff line
@@ -4427,6 +4427,30 @@ TEST_F(LayerUpdateTest, MergingTransactions) {
    }
}

TEST_F(LayerUpdateTest, MergingTransactionFlags) {
    Transaction().hide(mFGSurfaceControl).apply();
    std::unique_ptr<ScreenCapture> sc;
    {
        SCOPED_TRACE("before merge");
        ScreenCapture::captureScreen(&sc);
        sc->expectBGColor(0, 12);
        sc->expectBGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    Transaction t1, t2;
    t1.show(mFGSurfaceControl);
    t2.setFlags(mFGSurfaceControl, 0 /* flags */, layer_state_t::eLayerSecure /* mask */);
    t1.merge(std::move(t2));
    t1.apply();

    {
        SCOPED_TRACE("after merge");
        ScreenCapture::captureScreen(&sc);
        sc->expectFGColor(75, 75);
    }
}

class ChildLayerTest : public LayerUpdateTest {
protected:
    void SetUp() override {