From 35a6848fa813b6b3d5c41b2b6792f7b7effa195b Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 11 Jul 2018 10:56:48 -0700 Subject: [PATCH] Workaround for flicker between handoff from app to task view - Defer finishing the recents animation for a couple frames until the frame has likely been pushed to sf and drawn, otherwise the reparenting of the app surface may happen before the task view is visible in Launcher. Bug: 111299394 Test: Swipe up repeatedly from an app Change-Id: I627dc085a5e376436b2b8eb5841c45fd36deff42 --- .../quickstep/WindowTransformSwipeHandler.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java index 15ff19e260..902eb950de 100644 --- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -882,8 +882,21 @@ public class WindowTransformSwipeHandler { // new thumbnail finishTransitionPosted = new WindowCallbacksCompat(taskView) { + // The number of frames to defer until we actually finish the animation + private int mDeferFrameCount = 2; + @Override public void onPostDraw(Canvas canvas) { + if (mDeferFrameCount > 0) { + mDeferFrameCount--; + // Workaround, detach and reattach to invalidate the root node for + // another draw + detach(); + attach(); + taskView.invalidate(); + return; + } + setStateOnUiThread(STATE_SCREENSHOT_CAPTURED); detach(); }