From 3b81c90efb05c4a3f75cfb39b571dcde4a77c856 Mon Sep 17 00:00:00 2001 From: Filip Gruszczynski Date: Fri, 29 Jan 2016 17:38:51 -0800 Subject: [PATCH] Deliver onEnterAnimationComplete when there is no transition animation. Documentation says that Activity.onEnterAnimationComplete() will be called when it's safe to draw, so developers can wait for this callback to do work. In certain cases we never trigger this callback: when the screen is frozen and there is no transition animation and the window just popups into existence. In that case we should forcefully schedule this callback, so that it can be used reliably. Bug: 24005761 Change-Id: I2c20ca9bc7fa15ca53d9d492ad1c3f5f9608e8c4 --- .../java/com/android/server/wm/WindowManagerService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index e0e44dc4799f2..9dae1f5e6fcf9 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -4049,6 +4049,7 @@ public class WindowManagerService extends IWindowManager.Stub // * or the token was marked as hidden and is exiting before we had a chance to play the // transition animation // * or this is an opening app and windows are being replaced. + boolean visibilityChanged = false; if (wtoken.hidden == visible || (wtoken.hidden && wtoken.mIsExiting) || (visible && wtoken.waitingForReplacement())) { boolean changed = false; @@ -4115,6 +4116,7 @@ public class WindowManagerService extends IWindowManager.Stub } wtoken.hidden = wtoken.hiddenRequested = !visible; + visibilityChanged = true; if (!visible) { unsetAppFreezingScreenLocked(wtoken, true, true); } else { @@ -4152,6 +4154,13 @@ public class WindowManagerService extends IWindowManager.Stub } } + if (visibilityChanged && visible && !delayed) { + // The token was made immediately visible, there will be no entrance animation. We need + // to inform the client the enter animation was finished. + wtoken.mEnteringAnimation = true; + mActivityManagerAppTransitionNotifier.onAppTransitionFinishedLocked(wtoken.token); + } + return delayed; }