Skip layout if performShow fails.
In cases where a Surface does not go from hidden to shown, do not set
the perform layout flag. This keeps us out of repeated passes through
the layout code.
Fixes bug 6222487.
Change-Id: I22601bef5733d2f996a8cbdd50d6b89517bc3122
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index 7aa6716..fbfd9ec 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -67,24 +67,32 @@
final int NAT = mService.mAppTokens.size();
for (i=0; i<NAT; i++) {
final AppWindowToken appToken = mService.mAppTokens.get(i);
- final boolean wasAnimating = appToken.animation != null;
+ final boolean wasAnimating = appToken.animation != null
+ && appToken.animation != WindowManagerService.sDummyAnimation;
if (appToken.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
mAnimating = true;
} else if (wasAnimating) {
// stopped animating, do one more pass through the layout
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("appToken " + appToken + " done");
+ }
}
}
final int NEAT = mService.mExitingAppTokens.size();
for (i=0; i<NEAT; i++) {
final AppWindowToken appToken = mService.mExitingAppTokens.get(i);
- final boolean wasAnimating = appToken.animation != null;
+ final boolean wasAnimating = appToken.animation != null
+ && appToken.animation != WindowManagerService.sDummyAnimation;
if (appToken.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
mAnimating = true;
} else if (wasAnimating) {
// stopped animating, do one more pass through the layout
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("exiting appToken " + appToken + " done");
+ }
}
}
@@ -119,6 +127,9 @@
"First draw done in potential wallpaper target " + w);
mService.mInnerFields.mWallpaperMayChange = true;
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 1");
+ }
}
}
@@ -192,6 +203,9 @@
if (wasAnimating && !w.mAnimating && mService.mWallpaperTarget == w) {
mService.mInnerFields.mWallpaperMayChange = true;
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2");
+ }
}
if (mPolicy.doesForceHide(w, attrs)) {
@@ -201,6 +215,9 @@
+ w);
mService.mInnerFields.mWallpaperForceHidingChanged = true;
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 3");
+ }
mService.mFocusMayChange = true;
} else if (w.isReadyForDisplay() && w.mAnimation == null) {
mForceHiding = true;
@@ -239,6 +256,9 @@
& WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
mService.mInnerFields.mWallpaperMayChange = true;
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4");
+ }
}
}
}
@@ -286,8 +306,12 @@
}
}
} else if (w.mReadyToShow) {
- w.performShowLocked();
- mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
+ if (w.performShowLocked()) {
+ mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 5");
+ }
+ }
}
if (atoken != null && atoken.thumbnail != null) {
if (atoken.thumbnailTransactionSeq != mTransactionSequence) {
@@ -331,6 +355,9 @@
+ " drawn=" + wtoken.numDrawnWindows);
wtoken.allDrawn = true;
mPendingLayoutChanges |= PhoneWindowManager.FINISH_LAYOUT_REDO_ANIM;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("testTokenMayBeDrawnLocked");
+ }
// We can now show all of the drawn windows!
if (!mService.mOpeningApps.contains(wtoken)) {