summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jerry Chang <chenghsiuchang@google.com> 2021-05-05 20:37:01 +0800
committer Jerry Chang <chenghsiuchang@google.com> 2021-05-06 22:14:46 +0800
commitbb1f46f1cd576cfd39425acbfa2fe834efcaaa9a (patch)
tree25890127e3e5d26fce3a9f464366385d363b692a
parent3afe697d9426c8ca828fdc49167b1161df4694b4 (diff)
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
-rw-r--r--services/core/java/com/android/server/wm/Task.java7
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RootTaskTests.java30
2 files changed, 17 insertions, 20 deletions
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index e5e1a7a245d6..3fd08ea1e127 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -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:
diff --git a/services/tests/wmtests/src/com/android/server/wm/RootTaskTests.java b/services/tests/wmtests/src/com/android/server/wm/RootTaskTests.java
index 748622b810d5..2d3c5a87f59f 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RootTaskTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RootTaskTests.java
@@ -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 */);