diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerService.java | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 26ac79e97182..dcdf86c3dec3 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -1960,15 +1960,36 @@ public class WindowManagerService extends IWindowManager.Stub win.setDisplayLayoutNeeded(); win.mGivenInsetsPending = (flags & WindowManagerGlobal.RELAYOUT_INSETS_PENDING) != 0; - // We may be deferring layout passes at the moment, but since the client is interested - // in the new out values right now we need to force a layout. - mWindowPlacerLocked.performSurfacePlacement(true /* force */); - // We should only relayout if the view is visible, it is a starting window, or the // associated appToken is not hidden. final boolean shouldRelayout = viewVisibility == View.VISIBLE && - (win.mAppToken == null || win.mAttrs.type == TYPE_APPLICATION_STARTING - || !win.mAppToken.isClientHidden()); + (win.mAppToken == null || win.mAttrs.type == TYPE_APPLICATION_STARTING + || !win.mAppToken.isClientHidden()); + + // If we are not currently running the exit animation, we need to see about starting + // one. + // We don't want to animate visibility of windows which are pending replacement. + // In the case of activity relaunch child windows could request visibility changes as + // they are detached from the main application window during the tear down process. + // If we satisfied these visibility changes though, we would cause a visual glitch + // hiding the window before it's replacement was available. So we just do nothing on + // our side. + // This must be called before the call to performSurfacePlacement. + if (!shouldRelayout && winAnimator.hasSurface() && !win.mAnimatingExit) { + if (DEBUG_VISIBILITY) { + Slog.i(TAG_WM, + "Relayout invis " + win + ": mAnimatingExit=" + win.mAnimatingExit); + } + result |= RELAYOUT_RES_SURFACE_CHANGED; + if (!win.mWillReplaceWindow) { + focusMayChange = tryStartExitingAnimation(win, winAnimator, isDefaultDisplay, + focusMayChange); + } + } + + // We may be deferring layout passes at the moment, but since the client is interested + // in the new out values right now we need to force a layout. + mWindowPlacerLocked.performSurfacePlacement(true /* force */); if (shouldRelayout) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "relayoutWindow: viewVisibility_1"); @@ -2001,24 +2022,6 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.mEnterAnimationPending = false; winAnimator.mEnteringAnimation = false; - if (winAnimator.hasSurface() && !win.mAnimatingExit) { - if (DEBUG_VISIBILITY) Slog.i(TAG_WM, "Relayout invis " + win - + ": mAnimatingExit=" + win.mAnimatingExit); - // If we are not currently running the exit animation, we - // need to see about starting one. - // We don't want to animate visibility of windows which are pending - // replacement. In the case of activity relaunch child windows - // could request visibility changes as they are detached from the main - // application window during the tear down process. If we satisfied - // these visibility changes though, we would cause a visual glitch - // hiding the window before it's replacement was available. - // So we just do nothing on our side. - if (!win.mWillReplaceWindow) { - focusMayChange = tryStartExitingAnimation( - win, winAnimator, isDefaultDisplay, focusMayChange); - } - result |= RELAYOUT_RES_SURFACE_CHANGED; - } if (viewVisibility == View.VISIBLE && winAnimator.hasSurface()) { // We already told the client to go invisible, but the message may not be // handled yet, or it might want to draw a last frame. If we already have a |