From 798075a5663a940178a43562527eb2e23277b1d5 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Fri, 14 Jan 2022 11:12:48 +0800 Subject: [PATCH] Shift Recents task to top when opening Recents. Unlike usual opening/closing app transition, the Recents task should above Home task when opening recents, otherwise the home task would above the recents task so it will seems like the home been add into recents animation. Bug: 207297486 Test: enable shell transition, setup 3rd-party launcher as default home. Entering recents at home page and verify the home task won't stay on top. Change-Id: I9bac97cb79febf112ec9ac1bdbe3de205604b01d --- .../systemui/shared/system/RemoteTransitionCompat.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java index 2d5080eaaa221..f63e50e8b78b2 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java @@ -25,6 +25,8 @@ import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.window.TransitionFilter.CONTAINER_ORDER_TOP; +import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_RECENTS; + import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; @@ -145,6 +147,11 @@ public class RemoteTransitionCompat implements Parcelable { && taskInfo.pictureInPictureParams.isAutoEnterEnabled()) { pipTask = taskInfo.token; } + } else if (change.getTaskInfo() != null + && change.getTaskInfo().topActivityType == ACTIVITY_TYPE_RECENTS) { + // This task is for recents, keep it on top. + t.setLayer(leashMap.get(change.getLeash()), + info.getChanges().size() * 3 - i); } } // Also make all the wallpapers opaque since we want the visible from the start