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

This commit is contained in:
Wale Ogunwale
2018-03-24 01:06:06 +00:00
committed by Android (Google) Code Review
2 changed files with 24 additions and 2 deletions

View File

@@ -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}";
}

View File

@@ -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