Merge "Fix a flicker when opening app again quickly while it's exiting" into nyc-dev

This commit is contained in:
Chong Zhang
2016-05-09 21:16:48 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 5 deletions

View File

@@ -322,6 +322,14 @@ class WindowStateAnimator {
return mAnimation != null; return mAnimation != null;
} }
/**
* Is this window currently waiting to run an opening animation?
*/
boolean isWaitingForOpening() {
return mService.mAppTransition.isTransitionSet() && isDummyAnimation()
&& mService.mOpeningApps.contains(mWin.mAppToken);
}
void cancelExitAnimationForNextAnimationLocked() { void cancelExitAnimationForNextAnimationLocked() {
if (DEBUG_ANIM) Slog.d(TAG, if (DEBUG_ANIM) Slog.d(TAG,
"cancelExitAnimationForNextAnimationLocked: " + mWin); "cancelExitAnimationForNextAnimationLocked: " + mWin);
@@ -1448,8 +1456,7 @@ class WindowStateAnimator {
// the same app again before the app's surface is destroyed or saved, the surface // the same app again before the app's surface is destroyed or saved, the surface
// is always ready in the whole process.) If we go ahead here, the opening app // is always ready in the whole process.) If we go ahead here, the opening app
// will be shown with the full size before the correct animation spec arrives. // will be shown with the full size before the correct animation spec arrives.
if (mService.mAppTransition.isTransitionSet() && isDummyAnimation() && if (isWaitingForOpening()) {
mService.mOpeningApps.contains(w.mAppToken)) {
return; return;
} }

View File

@@ -772,7 +772,7 @@ class WindowSurfacePlacer {
} }
} }
} }
if (!winAnimator.isAnimationStarting()) { if (!winAnimator.isAnimationStarting() && !winAnimator.isWaitingForOpening()) {
// Updates the shown frame before we set up the surface. This is needed // Updates the shown frame before we set up the surface. This is needed
// because the resizing could change the top-left position (in addition to // because the resizing could change the top-left position (in addition to
// size) of the window. setSurfaceBoundariesLocked uses mShownPosition to // size) of the window. setSurfaceBoundariesLocked uses mShownPosition to
@@ -1236,8 +1236,8 @@ class WindowSurfacePlacer {
int topOpeningLayer = 0; int topOpeningLayer = 0;
if (animLp != null) { if (animLp != null) {
int layer = -1; int layer = -1;
for (int j = 0; j < wtoken.windows.size(); j++) { for (int j = 0; j < wtoken.allAppWindows.size(); j++) {
final WindowState win = wtoken.windows.get(j); final WindowState win = wtoken.allAppWindows.get(j);
// Clearing the mAnimatingExit flag before entering animation. It will be set to true // Clearing the mAnimatingExit flag before entering animation. It will be set to true
// if app window is removed, or window relayout to invisible. We don't want to // if app window is removed, or window relayout to invisible. We don't want to
// clear it out for windows that get replaced, because the animation depends on // clear it out for windows that get replaced, because the animation depends on
@@ -1249,6 +1249,14 @@ class WindowSurfacePlacer {
// they won't eventually be removed by WindowStateAnimator#finishExit. // they won't eventually be removed by WindowStateAnimator#finishExit.
if (!win.mWillReplaceWindow && !win.mRemoveOnExit) { if (!win.mWillReplaceWindow && !win.mRemoveOnExit) {
win.mAnimatingExit = false; win.mAnimatingExit = false;
// Clear mAnimating flag together with mAnimatingExit. When animation
// changes from exiting to entering, we need to clear this flag until the
// new animation gets applied, so that isAnimationStarting() becomes true
// until then.
// Otherwise applySurfaceChangesTransaction will faill to skip surface
// placement for this window during this period, one or more frame will
// show up with wrong position or scale.
win.mWinAnimator.mAnimating = false;
} }
if (win.mWinAnimator.mAnimLayer > layer) { if (win.mWinAnimator.mAnimLayer > layer) {
layer = win.mWinAnimator.mAnimLayer; layer = win.mWinAnimator.mAnimLayer;