From 1344b16208e6fc084ddfd1981de653eb076397c3 Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Wed, 7 Jun 2023 21:07:29 -0700 Subject: [PATCH] Detect 3p launcher move-to-front during recents. If entering recents with a 3p launcher below a translucent task, the 3p launcher will remain visible the whole time. This means that, upon "committing" to go home (swipe-to-home), the 3p launcher task will be brought to-front rather than launched. If, we don't check for this, the default behavior of Recents handler is to cancel the current recents transition if it sees a transition with unrecognized stuff that isn't related to it's session. So, add a check for 3p launcher moving-to-front and convert it into an "open" so the rest of recents treats it as such. Bug: 284195706 Test: add calendar widget to 3p launcher, open an event, swipe-to-home. Change-Id: I81cd2a69858f4e20fe0bf86be94ca0e2af06fc28 --- .../wm/shell/recents/RecentsTransitionHandler.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java index 8723f9b0181d1..466ae7350e6e9 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java @@ -598,6 +598,17 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { // Don't consider order-only changes as changing apps. if (!TransitionUtil.isOrderOnly(change)) { hasChangingApp = true; + } else if (isLeafTask && taskInfo.topActivityType == ACTIVITY_TYPE_HOME + && !mRecentsTask.equals(change.getContainer())) { + // Unless it is a 3p launcher. This means that the 3p launcher was already + // visible (eg. the "pausing" task is translucent over the 3p launcher). + // Treat it as if we are "re-opening" the 3p launcher. + if (openingTasks == null) { + openingTasks = new ArrayList<>(); + openingTaskIsLeafs = new IntArray(); + } + openingTasks.add(change); + openingTaskIsLeafs.add(1); } } }