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

Commit b4a6a771 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Update snapshot changes flags when visibility changes

Layerhistory walks through all snapshots and checks the change
flags before updating its state. When a layer moves offscreen,
we update its snapshot but did not update the change flag. This
cl fixes this.

Bug: 345021645
Test: presubmit
Flag: EXEMPT bugfix

Change-Id: Icee06279f0fa8b0f4c0539e99dde8960ba3fab31
parent 33bc33c3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -256,6 +256,9 @@ auto getBlendMode(const LayerSnapshot& snapshot, const RequestedLayerState& requ
}

void updateVisibility(LayerSnapshot& snapshot, bool visible) {
    if (snapshot.isVisible != visible) {
        snapshot.changes |= RequestedLayerState::Changes::Visibility;
    }
    snapshot.isVisible = visible;

    // TODO(b/238781169) we are ignoring this compat for now, since we will have
+11 −0
Original line number Diff line number Diff line
@@ -213,6 +213,17 @@ TEST_F(LayerSnapshotTest, childBehindParentCanBeHiddenByParent) {
    UPDATE_AND_VERIFY(mSnapshotBuilder, {1, 12, 121, 122, 1221, 13, 2});
}

TEST_F(LayerSnapshotTest, offscreenLayerSnapshotIsInvisible) {
    EXPECT_EQ(getSnapshot(111)->isVisible, true);

    reparentLayer(11, UNASSIGNED_LAYER_ID);
    destroyLayerHandle(11);
    UPDATE_AND_VERIFY(mSnapshotBuilder, {1, 12, 121, 122, 1221, 13, 2});

    EXPECT_EQ(getSnapshot(111)->isVisible, false);
    EXPECT_TRUE(getSnapshot(111)->changes.test(RequestedLayerState::Changes::Visibility));
}

// relative tests
TEST_F(LayerSnapshotTest, RelativeParentCanHideChild) {
    reparentRelativeLayer(13, 11);