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

Commit ae1617f9 authored by Chris Li's avatar Chris Li
Browse files

Prevent ZBoost of TaskDisplayArea

Before, when an activity needs z boost, the whole TDA is moved above
other windows of ABOVE_TASKS. Now, we don't move TDA anymore.

Fix: 149651594
Test: manual: open app and expand notification before app fully start,
the app no longer moves above notification.
Test: atest WmTests:TaskDisplayAreaTests#testActivityWithZBoost_TaskDisplayAreaDoesNotMovedUp

Change-Id: Ie1eae7a5566fc8988cd3ca9f4a56332743facf52
parent f13d436c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -106,6 +106,12 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
        }
    }

    @Override
    boolean needsZBoost() {
        // Z Boost should only happen at or below the ActivityStack level.
        return false;
    }

    @Override
    boolean fillsParent() {
        return true;
+22 −0
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;

import android.platform.test.annotations.Presubmit;

@@ -81,6 +84,25 @@ public class TaskDisplayAreaTests extends WindowTestsBase {
        mPinnedStack.removeImmediately();
    }

    @Test
    public void testActivityWithZBoost_taskDisplayAreaDoesNotMoveUp() {
        final ActivityStack stack = createTaskStackOnDisplay(
                WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, mDisplayContent);
        final Task task = createTaskInStack(stack, 0 /* userId */);
        final ActivityRecord activity = WindowTestUtils.createTestActivityRecord(mDisplayContent);
        task.addChild(activity, 0 /* addPos */);
        final TaskDisplayArea taskDisplayArea = activity.getDisplayArea();
        activity.mNeedsAnimationBoundsLayer = true;
        activity.mNeedsZBoost = true;
        spyOn(taskDisplayArea.mSurfaceAnimator);

        mDisplayContent.assignChildLayers(mTransaction);

        assertThat(activity.needsZBoost()).isTrue();
        assertThat(taskDisplayArea.needsZBoost()).isFalse();
        verify(taskDisplayArea.mSurfaceAnimator, never()).setLayer(eq(mTransaction), anyInt());
    }

    @Test
    public void testStackPositionChildAt() {
        // Test that always-on-top stack can't be moved to position other than top.