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

Commit bb1f46f1 authored by Jerry Chang's avatar Jerry Chang
Browse files

Make sure tasks not in split root is invisible while in split

When in split mode, home task will be reparented to the secondary split
and leaving tasks not supporting split below. Because TaskDisplayArea
always adjusts home surface layer to the bottom, this makes sure tasks
not in split root won't occlude home task unexpectedly.

Bug: 187153990
Fix: 185872271
Fix: 159767867
Test: atest RootTaskTests
Test: atest com.android.wm.shell.flicker.legacysplitscreen
Test: dock translucent task to split primary while having task not
supporting split in recent, recent app won't be occluded.
Test: primary task won't be invisible while in split minimized mode.

Change-Id: Iaff7e1810d87e5b724129c615c112cfa22dc5c36
parent 3afe697d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -4340,7 +4340,12 @@ class Task extends WindowContainer<WindowContainer> {
            case WINDOWING_MODE_FULLSCREEN:
                if (gotTranslucentSplitScreenPrimary || gotTranslucentSplitScreenSecondary) {
                    // At least one of the split-screen stacks that covers this one is translucent.
                    return TASK_VISIBILITY_VISIBLE_BEHIND_TRANSLUCENT;
                    // When in split mode, home task will be reparented to the secondary split while
                    // leaving tasks not supporting split below. Due to
                    // TaskDisplayArea#assignRootTaskOrdering always adjusts home surface layer to
                    // the bottom, this makes sure tasks not in split roots won't occlude home task
                    // unexpectedly.
                    return TASK_VISIBILITY_INVISIBLE;
                }
                break;
            case WINDOWING_MODE_SPLIT_SCREEN_PRIMARY:
+11 −19
Original line number Diff line number Diff line
@@ -585,38 +585,30 @@ public class RootTaskTests extends WindowTestsBase {

    @Test
    public void testShouldBeVisible_SplitScreen() {
        final Task homeRootTask = createTaskForShouldBeVisibleTest(mDefaultTaskDisplayArea,
                WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, true /* onTop */);
        // Home root task should always be fullscreen for this test.
        doReturn(false).when(homeRootTask).supportsSplitScreenWindowingMode();
        // task not supporting split should be fullscreen for this test.
        final Task notSupportingSplitTask = createTaskForShouldBeVisibleTest(
                mDefaultTaskDisplayArea, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD,
                true /* onTop */);
        doReturn(false).when(notSupportingSplitTask).supportsSplitScreenWindowingMode();
        final Task splitScreenPrimary = createTaskForShouldBeVisibleTest(mDefaultTaskDisplayArea,
                WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD, true /* onTop */);
        final Task splitScreenSecondary = createTaskForShouldBeVisibleTest(mDefaultTaskDisplayArea,
                WINDOWING_MODE_SPLIT_SCREEN_SECONDARY, ACTIVITY_TYPE_STANDARD, true /* onTop */);

        // Home root task shouldn't be visible if both halves of split-screen are opaque.
        // root task not supporting split shouldn't be visible if both halves of split-screen are
        // opaque.
        doReturn(false).when(splitScreenPrimary).isTranslucent(any());
        doReturn(false).when(splitScreenSecondary).isTranslucent(any());
        assertFalse(homeRootTask.shouldBeVisible(null /* starting */));
        assertFalse(notSupportingSplitTask.shouldBeVisible(null /* starting */));
        assertTrue(splitScreenPrimary.shouldBeVisible(null /* starting */));
        assertTrue(splitScreenSecondary.shouldBeVisible(null /* starting */));
        assertEquals(TASK_VISIBILITY_INVISIBLE, homeRootTask.getVisibility(null /* starting */));
        assertEquals(TASK_VISIBILITY_VISIBLE,
                splitScreenPrimary.getVisibility(null /* starting */));
        assertEquals(TASK_VISIBILITY_VISIBLE,
                splitScreenSecondary.getVisibility(null /* starting */));

        // Home root task should be visible if one of the halves of split-screen is translucent.
        // root task not supporting split shouldn't be visible if one of the halves of split-screen
        // is translucent.
        doReturn(true).when(splitScreenPrimary).isTranslucent(any());
        assertTrue(homeRootTask.shouldBeVisible(null /* starting */));
        assertFalse(notSupportingSplitTask.shouldBeVisible(null /* starting */));
        assertTrue(splitScreenPrimary.shouldBeVisible(null /* starting */));
        assertTrue(splitScreenSecondary.shouldBeVisible(null /* starting */));
        assertEquals(TASK_VISIBILITY_VISIBLE_BEHIND_TRANSLUCENT,
                homeRootTask.getVisibility(null /* starting */));
        assertEquals(TASK_VISIBILITY_VISIBLE,
                splitScreenPrimary.getVisibility(null /* starting */));
        assertEquals(TASK_VISIBILITY_VISIBLE,
                splitScreenSecondary.getVisibility(null /* starting */));

        final Task splitScreenSecondary2 = createTaskForShouldBeVisibleTest(mDefaultTaskDisplayArea,
                WINDOWING_MODE_SPLIT_SCREEN_SECONDARY, ACTIVITY_TYPE_STANDARD, true /* onTop */);