From 9220937682f635e3db3ae37035e6d165025ff25f Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Fri, 15 Apr 2022 14:45:54 +0800 Subject: [PATCH] Fix recents thumbnail wrong while swipe up This bug occured when it has multiple visible app targets need to show. If surface didn't have specific layer, their display order will be determined by create timing. By such rule, we should create their animation leash by down to top rather than top to down. This patch also fix wrong logic to create RecentsAnimationSplitTasks, we should only do that when split is active. Fix: 223396876 Fix: 207390696 Test: manual Test: pass existing tests Change-Id: I74a33cdc28d370f1db3910ebda8577c72416bc97 --- .../android/wm/shell/splitscreen/SplitScreenController.java | 2 +- .../com/android/server/wm/RecentsAnimationController.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index 10dfdc30d0d6b..dd2634ca36d94 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -414,7 +414,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel, RemoteAnimationTarget[] apps) { - if (ENABLE_SHELL_TRANSITIONS || apps.length < 2) return null; + if (ENABLE_SHELL_TRANSITIONS || !isSplitScreenVisible()) return null; // TODO(b/206487881): Integrate this with shell transition. SurfaceControl.Transaction transaction = new SurfaceControl.Transaction(); if (mSplitTasksContainerLayer != null) { diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index fc407e616bd94..efe617d86d4e4 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -445,7 +445,7 @@ public class RecentsAnimationController implements DeathRecipient { } final int taskCount = visibleTasks.size(); - for (int i = 0; i < taskCount; i++) { + for (int i = taskCount - 1; i >= 0; i--) { final Task task = visibleTasks.get(i); if (skipAnimation(task)) { continue; @@ -746,7 +746,7 @@ public class RecentsAnimationController implements DeathRecipient { ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS, "collectTaskRemoteAnimations, target: %s", target); } - }, true); + }, false /* traverseTopToBottom */); } void logRecentsAnimationStartTime(int durationMs) {