From d275b6b5209fab3d4c258cb33890927e6b2ffa22 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Thu, 10 Feb 2022 17:49:18 +0800 Subject: [PATCH] Cancel recents animation when touch home key There should send an opening task transition to remote transition handler to finish the recents animation. For now there is no opening transition send to Shell because the exist home activity won't be collected while start home activity. Bug: 207297486 Test: 1. Enable shell transition. 2. Setup 3rd-party launcher as default home. 3. Entering Recents from home. 4. "adb shell input keyevent KEYCODE_HOME", verify recents animation will be dismissed. Test: atest NexusLauncherTests:com.android.quickstep.FallbackRecentsTest Change-Id: Ib3b897d97e3fdee3131556d2810b49d434e0e70a --- .../shared/system/RemoteTransitionCompat.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 ace7938924732..b37544fd7bc57 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 @@ -236,10 +236,15 @@ public class RemoteTransitionCompat implements Parcelable { boolean merge(TransitionInfo info, SurfaceControl.Transaction t, RecentsAnimationListener recents) { ArrayList openingTasks = null; + boolean cancelRecents = false; for (int i = info.getChanges().size() - 1; i >= 0; --i) { final TransitionInfo.Change change = info.getChanges().get(i); if (change.getMode() == TRANSIT_OPEN || change.getMode() == TRANSIT_TO_FRONT) { if (change.getTaskInfo() != null) { + if (change.getTaskInfo().topActivityType == ACTIVITY_TYPE_HOME) { + // canceling recents animation + cancelRecents = true; + } if (openingTasks == null) { openingTasks = new ArrayList<>(); } @@ -249,9 +254,11 @@ public class RemoteTransitionCompat implements Parcelable { } if (openingTasks == null) return false; int pauseMatches = 0; - for (int i = 0; i < openingTasks.size(); ++i) { - if (mPausingTasks.contains(openingTasks.get(i).getContainer())) { - ++pauseMatches; + if (!cancelRecents) { + for (int i = 0; i < openingTasks.size(); ++i) { + if (mPausingTasks.contains(openingTasks.get(i).getContainer())) { + ++pauseMatches; + } } } if (pauseMatches > 0) {