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

Commit b9e9f094 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Make Assistant stack invisible behind split-screen stacks." into pi-dev

parents 02bfc970 8e923af9
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -1769,9 +1769,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        }

        final ActivityDisplay display = getDisplay();
        boolean gotSplitScreenStack = false;
        boolean gotOpaqueSplitScreenPrimary = false;
        boolean gotOpaqueSplitScreenSecondary = false;
        final int windowingMode = getWindowingMode();
        final boolean isAssistantType = isActivityTypeAssistant();
        for (int i = display.getChildCount() - 1; i >= 0; --i) {
            final ActivityStack other = display.getChildAt(i);
            if (other == this) {
@@ -1789,6 +1791,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                return false;
            } else if (otherWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
                    && !gotOpaqueSplitScreenPrimary) {
                gotSplitScreenStack = true;
                gotOpaqueSplitScreenPrimary =
                        !other.isStackTranslucent(starting);
                if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
@@ -1798,6 +1801,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                }
            } else if (otherWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY
                    && !gotOpaqueSplitScreenSecondary) {
                gotSplitScreenStack = true;
                gotOpaqueSplitScreenSecondary =
                        !other.isStackTranslucent(starting);
                if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY
@@ -1811,6 +1815,12 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                // the screen are opaque.
                return false;
            }
            if (isAssistantType && gotSplitScreenStack) {
                // Assistant stack can't be visible behind split-screen. In addition to this not
                // making sense, it also works around an issue here we boost the z-order of the
                // assistant window surfaces in window manager whenever it is visible.
                return false;
            }
        }

        // Well, nothing is stopping you from being visible...
@@ -5259,7 +5269,9 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        return "ActivityStack{" + Integer.toHexString(System.identityHashCode(this))
                + " stackId=" + mStackId + " type=" + activityTypeToString(getActivityType())
                + " mode=" + windowingModeToString(getWindowingMode())
                + " visible=" + shouldBeVisible(null /* starting */) + ", "
                + " visible=" + shouldBeVisible(null /* starting */)
                + " translucent=" + isStackTranslucent(null /* starting */)
                + ", "
                + mTaskHistory.size() + " tasks}";
    }

+11 −1
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ public class ActivityStackTests extends ActivityTestsBase {
        assertFalse(splitScreenSecondary.shouldBeVisible(null /* starting */));
        assertTrue(splitScreenSecondary2.shouldBeVisible(null /* starting */));

        // First split-screen secondary should be visible behind another translucent split-split
        // First split-screen secondary should be visible behind another translucent split-screen
        // secondary.
        splitScreenSecondary2.setIsTranslucent(true);
        assertTrue(splitScreenSecondary.shouldBeVisible(null /* starting */));
@@ -244,6 +244,16 @@ public class ActivityStackTests extends ActivityTestsBase {
        assertTrue(splitScreenPrimary.shouldBeVisible(null /* starting */));
        assertTrue(splitScreenSecondary.shouldBeVisible(null /* starting */));
        assertTrue(splitScreenSecondary2.shouldBeVisible(null /* starting */));

        // Assistant stack shouldn't be visible behind translucent split-screen stack
        assistantStack.setIsTranslucent(false);
        splitScreenPrimary.setIsTranslucent(true);
        splitScreenSecondary2.setIsTranslucent(true);
        splitScreenSecondary2.moveToFront("testShouldBeVisible_SplitScreen");
        splitScreenPrimary.moveToFront("testShouldBeVisible_SplitScreen");
        assertFalse(assistantStack.shouldBeVisible(null /* starting */));
        assertTrue(splitScreenPrimary.shouldBeVisible(null /* starting */));
        assertTrue(splitScreenSecondary2.shouldBeVisible(null /* starting */));
    }

    @Test