From e62eaa16b360433e35b4e4655e16c312a7bfd110 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Fri, 1 Nov 2019 12:37:08 -0700 Subject: [PATCH] Finish recents animation when launching another task in Overview App open animation gets cancelled because of screenshot cleanup (launcher is stopped). We need window manager support to allow them to go parallel (b/143774568). As a workaround, we can either (1) delay launching the next task until recents animation is properly cancelled (2) finish the recents animation before launching the next task. Performance is the same, so go with (2) since it's a cleaner solution Fixes: 143773683 Test: Swipe up to Overview from app, launch another task in Overview. See everything animate smoothly. Change-Id: Iafd3f6f529fba32c1113b766c033e5932f19f4f3 --- .../src/com/android/quickstep/views/TaskView.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java index 57327f8ab3..a1775f4284 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java @@ -287,11 +287,19 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { public void launchTask(boolean animate, boolean freezeTaskList, Consumer resultCallback, Handler resultCallbackHandler) { if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { + RecentsView recentsView = getRecentsView(); if (isRunningTask()) { - getRecentsView().finishRecentsAnimation(false /* toRecents */, + recentsView.finishRecentsAnimation(false /* toRecents */, () -> resultCallbackHandler.post(() -> resultCallback.accept(true))); } else { - launchTaskInternal(animate, freezeTaskList, resultCallback, resultCallbackHandler); + // This is a workaround against the WM issue that app open is not correctly animated + // when recents animation is being cleaned up (b/143774568). When that's possible, + // we should rely on the framework side to cancel the recents animation, and we will + // clean up the screenshot on the launcher side while we launch the next task. + recentsView.switchToScreenshot(null, + () -> recentsView.finishRecentsAnimation(true /* toRecents */, + () -> launchTaskInternal(animate, freezeTaskList, resultCallback, + resultCallbackHandler))); } } else { launchTaskInternal(animate, freezeTaskList, resultCallback, resultCallbackHandler);