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

Commit b1b24190 authored by Nick Chameyev's avatar Nick Chameyev
Browse files

Assign layers after adding a window

When adding a new window we create a WindowToken
that initially created without a surface.
When this window is attached to parent
we call onParentChanged that tries to assign the layers
for correct z-ordering of the surfaces
but this call is ignored for the newly created
WindowToken as it doesn't have the surface yet.
The surface for the WindowToken is created only when
the 'window' child is added but currently we do not
update z-order for it (it may happen only on the next
relayout).

Added logic that invokes assigning of layers again when
a window is added and when surface is ready.

Bug: 200103245
Test: add rotation suggestion button window, check that it is displayed above taskbar
Test: atest WmTests:WindowTokenTests
Change-Id: I38c2c4416edadd346c80d871325aa029b2c1445f
parent 78337f8a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -295,6 +295,9 @@ class WindowToken extends WindowContainer<WindowState> {
        // surface for this token.
        if (mSurfaceControl == null) {
            createSurfaceControl(true /* force */);

            // Layers could have been assigned before the surface was created, update them again
            reassignLayer(getSyncTransaction());
        }
        if (!mChildren.contains(win)) {
            ProtoLog.v(WM_DEBUG_ADD_REMOVE, "Adding %s to %s", win, this);
+14 −0
Original line number Diff line number Diff line
@@ -93,6 +93,20 @@ public class WindowTokenTests extends WindowTestsBase {
        assertEquals(window1.mToken, window12.mToken);
    }

    @Test
    public void testAddWindow_assignsLayers() {
        final TestWindowToken token1 = createTestWindowToken(0, mDisplayContent);
        final TestWindowToken token2 = createTestWindowToken(0, mDisplayContent);
        final WindowState window1 = createWindow(null, TYPE_STATUS_BAR, token1, "window1");
        final WindowState window2 = createWindow(null, TYPE_STATUS_BAR, token2, "window2");

        token1.addWindow(window1);
        token2.addWindow(window2);

        assertEquals(token1.getLastLayer(), 0);
        assertEquals(token2.getLastLayer(), 1);
    }

    @Test
    public void testChildRemoval() {
        final DisplayContent dc = mDisplayContent;