From 77e889f27177a9d4ed856710499ed9e5da3f16e8 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Sat, 6 May 2023 00:38:22 +0800 Subject: [PATCH] Put change type below closing type for a close transition Assume a translucent task is closing, the next visible task may be added to transition participant by collectOrderChanges as the task is moving to the foreground. Then the transition info will be {CLOSE, top:CHANGE, bottom:CLOSE}. So the z-order will be: numChanges=2 zSplitLine=3 CLOSE=3+2-1=4 CHANGE=3+2-0=5 Then the CLOSE is occluded by the CHANGE incorrectly. Bug: 281010752 Test: Launch a translucent activity from launcher and it calls Activity#finishAndRemoveTask(). The activity should not be covered by the icon on launcher during animation. Change-Id: I1236946c867abf1b93fca39c4dd9ed114118c051 --- .../com/android/wm/shell/transition/Transitions.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index a73ab776486b3..5ca0e992137ea 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -503,7 +503,9 @@ public class Transitions implements RemoteCallable, */ private static void setupAnimHierarchy(@NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction finishT) { - boolean isOpening = isOpeningType(info.getType()); + final int type = info.getType(); + final boolean isOpening = isOpeningType(type); + final boolean isClosing = isClosingType(type); for (int i = 0; i < info.getRootCount(); ++i) { t.show(info.getRoot(i).getLeash()); } @@ -556,7 +558,13 @@ public class Transitions implements RemoteCallable, layer = zSplitLine + numChanges - i; } } else { // CHANGE or other - layer = zSplitLine + numChanges - i; + if (isClosing) { + // Put below CLOSE mode. + layer = zSplitLine - i; + } else { + // Put above CLOSE mode. + layer = zSplitLine + numChanges - i; + } } t.setLayer(leash, layer); }