Merge "Fixes to clean up icon launching during animations."

This commit is contained in:
Craig Mautner
2012-12-26 11:56:30 -08:00
committed by Android (Google) Code Review
4 changed files with 33 additions and 22 deletions

View File

@@ -58,9 +58,9 @@ public class AppWindowAnimator {
}
public void setAnimation(Animation anim, int width, int height) {
if (WindowManagerService.localLOGV) Slog.v(
TAG, "Setting animation in " + mAppToken + ": " + anim
+ " wxh=" + width + "x" + height);
if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting animation in " + mAppToken
+ ": " + anim + " wxh=" + width + "x" + height
+ " isVisible=" + mAppToken.isVisible());
animation = anim;
animating = false;
if (!anim.isInitialized()) {
@@ -82,16 +82,17 @@ public class AppWindowAnimator {
}
// Start out animation gone if window is gone, or visible if window is visible.
transformation.clear();
transformation.setAlpha(mAppToken.reportedVisible ? 1 : 0);
transformation.setAlpha(mAppToken.isVisible() ? 1 : 0);
hasTransformation = true;
}
public void setDummyAnimation() {
if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting dummy animation in " + mAppToken);
if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting dummy animation in " + mAppToken
+ " isVisible=" + mAppToken.isVisible());
animation = sDummyAnimation;
hasTransformation = true;
transformation.clear();
transformation.setAlpha(mAppToken.reportedVisible ? 1 : 0);
transformation.setAlpha(mAppToken.isVisible() ? 1 : 0);
}
public void clearAnimation() {

View File

@@ -223,6 +223,22 @@ class AppWindowToken extends WindowToken {
return null;
}
boolean isVisible() {
final int N = allAppWindows.size();
// TODO: Consider using allDrawn instead of a single window.
for (int i=0; i<N; i++) {
WindowState win = allAppWindows.get(i);
if (!win.mAppFreezing
&& (win.mViewVisibility == View.VISIBLE ||
(win.mWinAnimator.isAnimating() &&
!service.mAppTransition.isTransitionSet()))
&& !win.mDestroying && win.isDrawnLw()) {
return true;
}
}
return false;
}
@Override
void dump(PrintWriter pw, String prefix) {
super.dump(pw, prefix);

View File

@@ -4476,8 +4476,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_TOKEN_MOVEMENT || DEBUG_REORDER) Slog.v(TAG,
"Start moving token " + wtoken + " initially at "
+ oldIndex);
if (oldIndex > index && mAppTransition.isTransitionSet()
&& !mAppTransition.isRunning()) {
if (oldIndex > index && mAppTransition.isTransitionSet()) {
// animation towards back has not started, copy old list for duration of animation.
mAnimatingAppTokens.clear();
mAnimatingAppTokens.addAll(mAppTokens);
@@ -4491,7 +4490,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_REORDER) Slog.v(TAG, "Moved " + token + " to " + index + ":");
else if (DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "Moved " + token + " to " + index);
if (DEBUG_REORDER) dumpAppTokensLocked();
if (!mAppTransition.isTransitionSet() && !mAppTransition.isRunning()) {
if (!mAppTransition.isTransitionSet()) {
// Not animating, bring animating app list in line with mAppTokens.
mAnimatingAppTokens.clear();
mAnimatingAppTokens.addAll(mAppTokens);
@@ -4612,11 +4611,9 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
if (!mAppTransition.isRunning()) {
mAnimatingAppTokens.clear();
mAnimatingAppTokens.addAll(mAppTokens);
moveAppWindowsLocked(tokens, mAppTokens.size());
}
mAnimatingAppTokens.clear();
mAnimatingAppTokens.addAll(mAppTokens);
moveAppWindowsLocked(tokens, mAppTokens.size());
}
Binder.restoreCallingIdentity(origId);
}
@@ -4631,7 +4628,7 @@ public class WindowManagerService extends IWindowManager.Stub
final long origId = Binder.clearCallingIdentity();
synchronized(mWindowMap) {
final int N = tokens.size();
if (N > 0 && !mAppTransition.isRunning()) {
if (N > 0) {
// animating towards back, hang onto old list for duration of animation.
mAnimatingAppTokens.clear();
mAnimatingAppTokens.addAll(mAppTokens);
@@ -4651,11 +4648,9 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
if (!mAppTransition.isRunning()) {
mAnimatingAppTokens.clear();
mAnimatingAppTokens.addAll(mAppTokens);
moveAppWindowsLocked(tokens, 0);
}
mAnimatingAppTokens.clear();
mAnimatingAppTokens.addAll(mAppTokens);
moveAppWindowsLocked(tokens, 0);
}
Binder.restoreCallingIdentity(origId);
}
@@ -7949,7 +7944,6 @@ public class WindowManagerService extends IWindowManager.Stub
final AppWindowAnimator appAnimator = wtoken.mAppAnimator;
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Now opening app" + wtoken);
appAnimator.clearThumbnail();
wtoken.reportedVisible = false;
wtoken.inPendingTransaction = false;
appAnimator.animation = null;
setTokenVisibilityLocked(wtoken, animLp, true, transit, false);

View File

@@ -1223,7 +1223,7 @@ class WindowStateAnimator {
if (mIsWallpaper && !mWin.mWallpaperVisible) {
// Wallpaper is no longer visible and there is no wp target => hide it.
hide();
} else if (w.mAttachedHidden || !w.isReadyForDisplay()) {
} else if (w.mAttachedHidden || !w.isOnScreen()) {
hide();
mAnimator.hideWallpapersLocked(w);