From 1df9c3c6bd985cf5819b6c1e9fb8ff096950dfa8 Mon Sep 17 00:00:00 2001 From: Winson Date: Thu, 6 Aug 2015 16:46:01 -0700 Subject: [PATCH] Pushing the startActivity before the calls to remove task. - It appears that there is contention between startActivityAsUser() and removeTask() (called on two separate threads) which can cause jank when a user removes all the tasks from their recents list. This CL ensures that startActivityAsUser() is always run first so it is not blocked by the other call (which should be able to run in the background uninterrupted). Bug: 22760556 Change-Id: I7564a2f0e43414686419d3657379bbd0ca6b4152 --- .../com/android/systemui/recents/views/TaskStackView.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index abdebf362067f..0068f84003b19 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -1121,9 +1121,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal mViewPool.returnViewToPool(tv); } - // Notify the callback that we've removed the task and it can clean up after it - mCb.onTaskViewDismissed(removedTask); - // Get the stack scroll of the task to anchor to (since we are removing something, the front // most task will be our anchor task) Task anchorTask = null; @@ -1172,6 +1169,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // Fade the dismiss button back in showDismissAllButton(); } + + // Notify the callback that we've removed the task and it can clean up after it. Note, we + // do this after onAllTaskViewsDismissed() is called, to allow the home activity to be + // started before the call to remove the task. + mCb.onTaskViewDismissed(removedTask); } @Override