summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2023-06-06 06:38:16 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-06-06 06:38:16 +0000
commit1b7654b696367070f51839087844affdc7dae851 (patch)
treefb13b86097968ef7239d18a62b0e46c83c00693e
parent48c068b41ef4c5dafef8f4cff63406b21e66b54f (diff)
parentdeaed7c79ad8aa9059be213b7a397d365c6bfaea (diff)
Merge "Only apply transient visibility for root task" into udc-dev am: deaed7c79a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23557640 Change-Id: I0df42e5525ff481f0258f8bab26fcdd138f3a67c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--services/core/java/com/android/server/wm/TaskFragment.java6
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RootTaskTests.java25
2 files changed, 29 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java
index c6c3b14bf98b..0c1f33ccedbc 100644
--- a/services/core/java/com/android/server/wm/TaskFragment.java
+++ b/services/core/java/com/android/server/wm/TaskFragment.java
@@ -1017,8 +1017,11 @@ class TaskFragment extends WindowContainer<WindowContainer> {
if (isTopActivityLaunchedBehind()) {
return TASK_FRAGMENT_VISIBILITY_VISIBLE;
}
+ final WindowContainer<?> parent = getParent();
final Task thisTask = asTask();
- if (thisTask != null && mTransitionController.isTransientHide(thisTask)) {
+ if (thisTask != null && parent.asTask() == null
+ && mTransitionController.isTransientHide(thisTask)) {
+ // Keep transient-hide root tasks visible. Non-root tasks still follow standard rule.
return TASK_FRAGMENT_VISIBILITY_VISIBLE;
}
@@ -1028,7 +1031,6 @@ class TaskFragment extends WindowContainer<WindowContainer> {
// This TaskFragment is only considered visible if all its parent TaskFragments are
// considered visible, so check the visibility of all ancestor TaskFragment first.
- final WindowContainer parent = getParent();
if (parent.asTaskFragment() != null) {
final int parentVisibility = parent.asTaskFragment().getVisibility(starting);
if (parentVisibility == TASK_FRAGMENT_VISIBILITY_INVISIBLE) {
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 fb29d3adb52b..abf21a57dd40 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RootTaskTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RootTaskTests.java
@@ -641,6 +641,31 @@ public class RootTaskTests extends WindowTestsBase {
// Home split secondary and home task should be invisible.
assertEquals(TASK_FRAGMENT_VISIBILITY_INVISIBLE,
splitSecondary.getVisibility(null /* starting */));
+
+ // Put another task on top of primary split.
+ final Task topSplitPrimary = new TaskBuilder(mSupervisor).setParentTask(organizer.mPrimary)
+ .setCreateActivity(true).build();
+ doReturn(false).when(topSplitPrimary).isTranslucent(any());
+ // Convert the fullscreen translucent task to opaque.
+ doReturn(false).when(translucentRootTask).isTranslucent(any());
+ translucentRootTask.moveToFront("test");
+ // The tasks of primary split are occluded by the fullscreen opaque task.
+ assertEquals(TASK_FRAGMENT_VISIBILITY_INVISIBLE,
+ organizer.mPrimary.getVisibility(null /* starting */));
+ assertEquals(TASK_FRAGMENT_VISIBILITY_INVISIBLE,
+ topSplitPrimary.getVisibility(null /* starting */));
+ // Make primary split root transient-hide.
+ spyOn(splitPrimary.mTransitionController);
+ doReturn(true).when(splitPrimary.mTransitionController).isTransientHide(
+ organizer.mPrimary);
+ // The split root and its top become visible.
+ assertEquals(TASK_FRAGMENT_VISIBILITY_VISIBLE,
+ organizer.mPrimary.getVisibility(null /* starting */));
+ assertEquals(TASK_FRAGMENT_VISIBILITY_VISIBLE,
+ topSplitPrimary.getVisibility(null /* starting */));
+ // The bottom of primary split becomes invisible because it is occluded by topSplitPrimary.
+ assertEquals(TASK_FRAGMENT_VISIBILITY_INVISIBLE,
+ splitPrimary.getVisibility(null /* starting */));
}
@Test