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

Commit 5e28cb5f authored by Jerry Chang's avatar Jerry Chang
Browse files

Fix divider bar shown on top of tasks above split pair

Since we allow launching fullscreen task on the top of split screen pair
now. There's a case when the task above split pair is translucent, which
should occlude divider bar while split pair is visible. Updates layering
rule in TaskDisplayArea to make sure tasks above split pair also having
higher layer than divider bar.

Fix: 201571272
Bug: 202740040
Test: atest ZorderingTests
Test: trigger split screen and launch quicksearch, observed divider bar
      will be occluded by quicksearch task.
Change-Id: Iaab59851a65f12556c1b1e894914ae197b8d8401
parent 4adb5658
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -798,12 +798,9 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
        int layer = 0;
        // Place root home tasks to the bottom.
        layer = adjustRootTaskLayer(t, mTmpHomeChildren, layer);
        adjustRootTaskLayer(t, mTmpNormalChildren, layer);

        // Always on top tasks layer should higher than split divider layer so set it as start.
        t.setLayer(mSplitScreenDividerAnchor, SPLIT_DIVIDER_LAYER);
        layer = SPLIT_DIVIDER_LAYER + 1;
        layer = adjustRootTaskLayer(t, mTmpNormalChildren, layer);
        adjustRootTaskLayer(t, mTmpAlwaysOnTopChildren, layer);
        t.setLayer(mSplitScreenDividerAnchor, SPLIT_DIVIDER_LAYER);
    }

    /**
@@ -818,19 +815,33 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
            ArrayList<WindowContainer> children, int startLayer) {
        mTmpNeedsZBoostIndexes.clear();
        final int childCount = children.size();
        boolean hasAdjacentTask = false;
        for (int i = 0; i < childCount; i++) {
            final WindowContainer child = children.get(i);
            final TaskDisplayArea childTda = child.asTaskDisplayArea();

            boolean childNeedsZBoost = childTda != null
            final boolean childNeedsZBoost = childTda != null
                    ? childTda.childrenNeedZBoost()
                    : child.needsZBoost();

            if (!childNeedsZBoost) {
                child.assignLayer(t, startLayer++);
            } else {
            if (childNeedsZBoost) {
                mTmpNeedsZBoostIndexes.add(i);
                continue;
            }

            final Task childTask = child.asTask();
            final boolean inAdjacentTask = childTask != null
                    && child.inMultiWindowMode()
                    && childTask.getRootTask().getAdjacentTaskFragment() != null;

            if (inAdjacentTask || child.inSplitScreenWindowingMode()) {
                hasAdjacentTask = true;
            } else if (hasAdjacentTask && startLayer < SPLIT_DIVIDER_LAYER) {
                // Task on top of adjacent tasks should be higher than split divider layer so
                // set it as start.
                startLayer = SPLIT_DIVIDER_LAYER + 1;
            }

            child.assignLayer(t, startLayer++);
        }

        final int zBoostSize = mTmpNeedsZBoostIndexes.size();
+33 −16
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
@@ -469,24 +468,42 @@ public class ZOrderingTests extends WindowTestsBase {

    @Test
    public void testDockedDividerPosition() {
        final WindowState pinnedStackWindow = createWindow(null, WINDOWING_MODE_PINNED,
                ACTIVITY_TYPE_STANDARD, TYPE_BASE_APPLICATION, mDisplayContent,
                "pinnedStackWindow");
        final WindowState splitScreenWindow = createWindow(null,
                WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD, TYPE_BASE_APPLICATION,
                mDisplayContent, "splitScreenWindow");
        final WindowState splitScreenSecondaryWindow = createWindow(null,
                WINDOWING_MODE_SPLIT_SCREEN_SECONDARY, ACTIVITY_TYPE_STANDARD,
                TYPE_BASE_APPLICATION, mDisplayContent, "splitScreenSecondaryWindow");
        final WindowState assistantStackWindow = createWindow(null,
                WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_ASSISTANT, TYPE_BASE_APPLICATION,
                mDisplayContent, "assistantStackWindow");
        final Task pinnedTask =
                createTask(mDisplayContent, WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD);
        final WindowState pinnedWindow =
                createAppWindow(pinnedTask, ACTIVITY_TYPE_STANDARD, "pinnedWindow");

        final Task belowTask =
                createTask(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
        final WindowState belowTaskWindow =
                createAppWindow(belowTask, ACTIVITY_TYPE_STANDARD, "belowTaskWindow");

        final Task splitScreenTask1 =
                createTask(mDisplayContent, WINDOWING_MODE_MULTI_WINDOW, ACTIVITY_TYPE_STANDARD);
        final WindowState splitWindow1 =
                createAppWindow(splitScreenTask1, ACTIVITY_TYPE_STANDARD, "splitWindow1");
        final Task splitScreenTask2 =
                createTask(mDisplayContent, WINDOWING_MODE_MULTI_WINDOW, ACTIVITY_TYPE_STANDARD);
        final WindowState splitWindow2 =
                createAppWindow(splitScreenTask2, ACTIVITY_TYPE_STANDARD, "splitWindow2");
        splitScreenTask1.setAdjacentTaskFragment(splitScreenTask2);
        splitScreenTask2.setAdjacentTaskFragment(splitScreenTask1);

        final Task aboveTask =
                createTask(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
        final WindowState aboveTaskWindow =
                createAppWindow(aboveTask, ACTIVITY_TYPE_STANDARD, "aboveTaskWindow");

        mDisplayContent.assignChildLayers(mTransaction);

        assertWindowHigher(mDockedDividerWindow, splitScreenWindow);
        assertWindowHigher(mDockedDividerWindow, splitScreenSecondaryWindow);
        assertWindowHigher(pinnedStackWindow, mDockedDividerWindow);
        assertWindowHigher(splitWindow1, belowTaskWindow);
        assertWindowHigher(splitWindow1, belowTaskWindow);
        assertWindowHigher(splitWindow2, belowTaskWindow);
        assertWindowHigher(splitWindow2, belowTaskWindow);
        assertWindowHigher(mDockedDividerWindow, splitWindow1);
        assertWindowHigher(mDockedDividerWindow, splitWindow2);
        assertWindowHigher(aboveTaskWindow, mDockedDividerWindow);
        assertWindowHigher(pinnedWindow, aboveTaskWindow);
    }

    @Test