From c9d0d0039255e7117eb326fab2b64a7180dceeb5 Mon Sep 17 00:00:00 2001 From: Tiger Huang Date: Wed, 29 May 2019 22:55:29 +0800 Subject: Fix a bug about missing committing app visibility If we have pending transitions, committing visibility would be delayed until the opening apps are all drawn. However, the original logic in AppWindowToken.transferStartingWindow would just remove the app from mOpeningApps which caused the app visibility would not be committed. This CL doesn't remove the app from mOpeningApps while transferring the starting window. Instead, we set a flag to indicate that we no longer need to apply an animation to the app. In this way, the app visibility will be committed. Fix: 131180307 Test: atest WindowManagerSmokeTest Test: Steps in the bug Change-Id: Ia84d73136dcbda07ae055b91f5a038e1bc070d2a --- .../core/java/com/android/server/wm/AppWindowToken.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index cae7612e0fcc..4a9a3f71f90e 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -176,6 +176,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree boolean inPendingTransaction; boolean allDrawn; private boolean mLastAllDrawn; + private boolean mUseTransferredAnimation; // Set to true when this app creates a surface while in the middle of an animation. In that // case do not clear allDrawn until the animation completes. @@ -618,9 +619,12 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree boolean runningAppAnimation = false; if (transit != WindowManager.TRANSIT_UNSET) { - if (applyAnimationLocked(lp, transit, visible, isVoiceInteraction)) { - delayed = runningAppAnimation = true; + if (mUseTransferredAnimation) { + runningAppAnimation = isReallyAnimating(); + } else if (applyAnimationLocked(lp, transit, visible, isVoiceInteraction)) { + runningAppAnimation = true; } + delayed = runningAppAnimation; final WindowState window = findMainWindow(); if (window != null && accessibilityController != null) { accessibilityController.onAppWindowTransitionLocked(window, transit); @@ -667,6 +671,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree getDisplayContent().getInputMonitor().updateInputWindowsLw(false /*force*/); } } + mUseTransferredAnimation = false; if (isReallyAnimating()) { delayed = true; @@ -1531,9 +1536,9 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree transferAnimation(fromToken); // When transferring an animation, we no longer need to apply an animation to the - // the token we transfer the animation over. Thus, remove the animation from - // pending opening apps. - getDisplayContent().mOpeningApps.remove(this); + // the token we transfer the animation over. Thus, set this flag to indicate we've + // transferred the animation. + mUseTransferredAnimation = true; mWmService.updateFocusedWindowLocked( UPDATE_FOCUS_WILL_PLACE_SURFACES, true /*updateInputWindows*/); -- cgit v1.2.3-59-g8ed1b