From fd1d75234763030ff9da32ac75502c9a82525642 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Fri, 26 Feb 2021 17:48:42 -0800 Subject: [PATCH] Check if the recents animation is still running and whether the app being restarted is the live tile app in mLiveTileRestartListener mLiveTileRestartListener is originally used to render the animation to launch the app that's the live tile app (for example, settings is the live tile app and we can launch settings from notification shade). However, we don't want this callback to be triggered when the recents animation is finished / live tile is ended because the default animation in that case won't be skipped. The other scenario that we don't want the animation to be rendered here is when the restarted app is not the live tile app. This can be repro'ed in this scenario - launch any app and go to live tile; launch settings; swipe up from settings; launch the previous live tile app. In this case, we rely on the mLaunchOtherTaskHandler take care of the rendering of this animation. Fixes: 181372992 Test: manual Change-Id: I41b63ce5163f1ac136bf8b5909907a3f84d937d8 --- quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java | 4 +++- quickstep/src/com/android/quickstep/views/RecentsView.java | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index feeee502de..808f26e269 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1494,7 +1494,9 @@ public abstract class AbsSwipeUpHandler, Q extends @Override public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task, boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) { - if (mRecentsAnimationTargets.hasTask(task.taskId)) { + if (mRecentsView.getRunningTaskIndex() != -1 + && mRecentsView.getRunningTaskId() == task.taskId + && mRecentsAnimationTargets.hasTask(task.taskId)) { launchOtherTaskInLiveTileMode(task.taskId, mRecentsAnimationTargets.apps); } ActivityManagerWrapper.getInstance().unregisterTaskStackListener( diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index deb1388e96..361c545667 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1106,6 +1106,10 @@ public abstract class RecentsView extends PagedView } } + public int getRunningTaskId() { + return mRunningTaskId; + } + public @Nullable TaskView getRunningTaskView() { return getTaskView(mRunningTaskId); }