From 61b8111d42967cf9e3876be275660babc74bd5bc Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 17 Jul 2017 18:08:15 -0700 Subject: [PATCH] Fix flicker when transiting activities without animation. In O, we added the logic surrounding this diff, to handle cases where stack visibility changes but there is no app transition (e.g. docked and pinned stack dismissal). We need to be careful to not immediately hide the Surfaces in the case where there is a transition though. It's possible there is a transition, even if delayed is false, in the cases where we have a custom null animation. Bug: 38031364 Test: Repro from bug. Dismiss docked stack ~10x. Dismiss pinned stack ~10x. go/wm-smoke Change-Id: I9dac7b9a4794787187c8e9226ab9d8ded282c116 --- .../java/com/android/server/wm/AppWindowToken.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index b9d02a900d1c3..63890bf346efc 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -431,11 +431,18 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree mEnteringAnimation = true; mService.mActivityManagerAppTransitionNotifier.onAppTransitionFinishedLocked(token); } + // If we are hidden but there is no delay needed we immediately // apply the Surface transaction so that the ActivityManager - // can have some guarantee on the Surface state - // following setting the visibility. - if (hidden && !delayed) { + // can have some guarantee on the Surface state following + // setting the visibility. This captures cases like dismissing + // the docked or pinned stack where there is no app transition. + // + // In the case of a "Null" animation, there will be + // no animation but there will still be a transition set. + // We still need to delay hiding the surface such that it + // can be synchronized with showing the next surface in the transition. + if (hidden && !delayed && !mService.mAppTransition.isTransitionSet()) { SurfaceControl.openTransaction(); for (int i = mChildren.size() - 1; i >= 0; i--) { mChildren.get(i).mWinAnimator.hide("immediately hidden");