Merge "Fix a bug where surface crashes when the enter animation starts while the exit animation has not yet finished" into ics-mr1

This commit is contained in:
satok
2011-10-25 10:48:23 -07:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 6 deletions

View File

@@ -2578,11 +2578,7 @@ public class WindowManagerService extends IWindowManager.Stub
(win.mAppToken == null || !win.mAppToken.clientHidden)) {
displayed = !win.isVisibleLw();
if (win.mExiting) {
win.mExiting = false;
if (win.mAnimation != null) {
win.mAnimation.cancel();
win.mAnimation = null;
}
win.cancelExitAnimationForNextAnimationLocked();
}
if (win.mDestroying) {
win.mDestroying = false;

View File

@@ -596,6 +596,18 @@ final class WindowState implements WindowManagerPolicy.WindowState {
}
}
// TODO: Fix and call finishExit() instead of cancelExitAnimationForNextAnimationLocked()
// for avoiding the code duplication.
void cancelExitAnimationForNextAnimationLocked() {
if (!mExiting) return;
if (mAnimation != null) {
mAnimation.cancel();
mAnimation = null;
destroySurfaceLocked();
}
mExiting = false;
}
Surface createSurfaceLocked() {
if (mSurface == null) {
mReportDestroySurface = false;
@@ -1742,4 +1754,4 @@ final class WindowState implements WindowManagerPolicy.WindowState {
}
return mStringNameCache;
}
}
}