diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 0e9e3ad029..d43bb24a1e 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -350,8 +350,7 @@ public final class RecentsActivity extends StatefulActivity { public void startHome() { if (LIVE_TILE.get()) { RecentsView recentsView = getOverviewPanel(); - recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true, - this::startHomeInternal)); + recentsView.switchToScreenshotAndFinishAnimationToRecents(this::startHomeInternal); } else { startHomeInternal(); } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index a4c60cf239..74906ddac0 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -177,6 +177,10 @@ public abstract class RecentsView CONTENT_ALPHA = new FloatProperty("contentAlpha") { @Override @@ -2355,8 +2359,12 @@ public abstract class RecentsView ActivityManagerWrapper.getInstance() - .removeTask(taskView.getTask().key.id)); + switchToScreenshotAndFinishAnimationToRecents(() -> { + UI_HELPER_EXECUTOR.getHandler().postDelayed(() -> + ActivityManagerWrapper.getInstance().removeTask( + taskView.getTask().key.id), + REMOVE_TASK_WAIT_FOR_APP_STOP_MS); + }); mActivity.getStatsLogManager().logger() .withItemInfo(taskView.getItemInfo()) .log(LAUNCHER_TASK_DISMISS_SWIPE_UP); @@ -2460,10 +2468,13 @@ public abstract class RecentsView { if (isSuccess) { // Remove all the task views now - UI_HELPER_EXECUTOR.execute( - ActivityManagerWrapper.getInstance()::removeAllRecentTasks); - removeTasksViewsAndClearAllButton(); - startHome(); + switchToScreenshotAndFinishAnimationToRecents(() -> { + UI_HELPER_EXECUTOR.getHandler().postDelayed( + ActivityManagerWrapper.getInstance()::removeAllRecentTasks, + REMOVE_TASK_WAIT_FOR_APP_STOP_MS); + removeTasksViewsAndClearAllButton(); + startHome(); + }); } mPendingAnimation = null; }); @@ -2618,9 +2629,7 @@ public abstract class RecentsView finishRecentsAnimation(true /* toRecents */, - this::updateRecentsRotation)); + switchToScreenshotAndFinishAnimationToRecents(this::updateRecentsRotation); mEnableDrawingLiveTile = false; } else { updateRecentsRotation(); @@ -3613,6 +3622,10 @@ public abstract class RecentsView finishRecentsAnimation(true /* toRecents */, onFinishRunnable)); + } + /** * Switch the current running task view to static snapshot mode, * capturing the snapshot at the same time.