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
This commit is contained in:
wilsonshih
2022-02-10 17:49:18 +08:00
parent 18b848e66a
commit d275b6b520

View File

@@ -236,10 +236,15 @@ public class RemoteTransitionCompat implements Parcelable {
boolean merge(TransitionInfo info, SurfaceControl.Transaction t,
RecentsAnimationListener recents) {
ArrayList<TransitionInfo.Change> 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) {