diff options
4 files changed, 48 insertions, 27 deletions
diff --git a/services/java/com/android/server/wm/DimAnimator.java b/services/java/com/android/server/wm/DimAnimator.java index b08c864826c3..f9f9d1a51cfc 100644 --- a/services/java/com/android/server/wm/DimAnimator.java +++ b/services/java/com/android/server/wm/DimAnimator.java @@ -42,10 +42,17 @@ class DimAnimator { DimAnimator (SurfaceSession session) { if (mDimSurface == null) { try { - mDimSurface = new Surface(session, 0, + if (WindowManagerService.DEBUG_SURFACE_TRACE) { + mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0, "DimAnimator", -1, 16, 16, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM); + } else { + mDimSurface = new Surface(session, 0, + "DimAnimator", + -1, 16, 16, PixelFormat.OPAQUE, + Surface.FX_SURFACE_DIM); + } if (WindowManagerService.SHOW_TRANSACTIONS || WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG, " DIM " + mDimSurface + ": CREATE"); diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java index 7611a0ffbd7d..f946f6cc5634 100644 --- a/services/java/com/android/server/wm/WindowAnimator.java +++ b/services/java/com/android/server/wm/WindowAnimator.java @@ -75,6 +75,9 @@ public class WindowAnimator { DimAnimator mDimAnimator = null; DimAnimator.Parameters mDimParams = null; + static final int WALLPAPER_ACTION_PENDING = 1; + int mPendingActions; + WindowAnimator(final WindowManagerService service, final Context context, final WindowManagerPolicy policy) { mService = service; @@ -364,7 +367,9 @@ public class WindowAnimator { for (int i=unForceHiding.size()-1; i>=0; i--) { Animation a = mPolicy.createForceHideEnterAnimation(wallpaperInUnForceHiding); if (a != null) { - unForceHiding.get(i).setAnimation(a); + final WindowStateAnimator winAnimator = unForceHiding.get(i); + winAnimator.setAnimation(a); + winAnimator.mAnimationIsEntrance = true; } } } @@ -421,13 +426,16 @@ public class WindowAnimator { mWindowAnimationBackgroundColor = 0; updateWindowsAndWallpaperLocked(); + if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) { + mPendingActions |= WALLPAPER_ACTION_PENDING; + } if (mTokenMayBeDrawn) { testTokenMayBeDrawnLocked(); } } - void animate() { + synchronized void animate() { mPendingLayoutChanges = 0; mCurrentTime = SystemClock.uptimeMillis(); mBulkUpdateParams = 0; @@ -554,4 +562,8 @@ public class WindowAnimator { mAnimDh = animDh; } } + + synchronized void clearPendingActions() { + mPendingActions = 0; + } } diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index f698fbc17766..f64ad122dcc9 100755 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -1629,9 +1629,7 @@ public class WindowManagerService extends IWindowManager.Stub "Found wallpaper activity: #" + i + "=" + w); foundW = w; foundI = i; - if (w == mWallpaperTarget && ((w.mAppToken != null - && w.mAppToken.mAppAnimator.animation != null) - || w.mWinAnimator.mAnimation != null)) { + if (w == mWallpaperTarget && w.mWinAnimator.isAnimating()) { // The current wallpaper target is animating, so we'll // look behind it for another possible target and figure // out what is going on below. @@ -6618,6 +6616,7 @@ public class WindowManagerService extends IWindowManager.Stub public static final int SET_WALLPAPER_OFFSET = ANIMATOR_WHAT_OFFSET + 2; public static final int SET_DIM_PARAMETERS = ANIMATOR_WHAT_OFFSET + 3; public static final int SET_MOVE_ANIMATION = ANIMATOR_WHAT_OFFSET + 4; + public static final int CLEAR_PENDING_ACTIONS = ANIMATOR_WHAT_OFFSET + 5; private Session mLastReportedHold; @@ -7070,7 +7069,8 @@ public class WindowManagerService extends IWindowManager.Stub } if (doRequest) { - requestTraversalLocked(); + mH.sendEmptyMessage(CLEAR_PENDING_ACTIONS); + performLayoutAndPlaceSurfacesLocked(); } } break; @@ -7111,6 +7111,11 @@ public class WindowManagerService extends IWindowManager.Stub scheduleAnimationLocked(); break; } + + case CLEAR_PENDING_ACTIONS: { + mAnimator.clearPendingActions(); + break; + } } if (DEBUG_WINDOW_TRACE) { Slog.v(TAG, "handleMessage: exit"); diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java index 0cebee76bf56..74e3304b02fd 100644 --- a/services/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/java/com/android/server/wm/WindowStateAnimator.java @@ -186,6 +186,7 @@ class WindowStateAnimator { if (mAnimation != null) { mAnimation.cancel(); mAnimation = null; + mLocalAnimating = false; destroySurfaceLocked(); } } @@ -262,9 +263,6 @@ class WindowStateAnimator { // If the display is frozen, and there is a pending animation, // clear it and make sure we run the cleanup code. mAnimating = true; - mLocalAnimating = true; - mAnimation.cancel(); - mAnimation = null; } if (!mAnimating && !mLocalAnimating) { @@ -878,11 +876,14 @@ class WindowStateAnimator { ": " + mWin.mShownFrame + ", alpha=" + mTransformation.getAlpha() + ", mShownAlpha=" + mShownAlpha); return; + } else if (mWin.mIsWallpaper && + (mAnimator.mPendingActions & WindowAnimator.WALLPAPER_ACTION_PENDING) != 0) { + return; } if (WindowManagerService.localLOGV) Slog.v( - TAG, "computeShownFrameLocked: " + this + - " not attached, mAlpha=" + mAlpha); + TAG, "computeShownFrameLocked: " + this + + " not attached, mAlpha=" + mAlpha); mWin.mShownFrame.set(mWin.mFrame); if (mWin.mXOffset != 0 || mWin.mYOffset != 0) { mWin.mShownFrame.offset(mWin.mXOffset, mWin.mYOffset); @@ -920,19 +921,19 @@ class WindowStateAnimator { mSurfaceH = height; } - if (mSurfaceX != w.mShownFrame.left - || mSurfaceY != w.mShownFrame.top) { + final float left = w.mShownFrame.left; + final float top = w.mShownFrame.top; + if (mSurfaceX != left || mSurfaceY != top) { try { if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w, - "POS " + w.mShownFrame.left - + ", " + w.mShownFrame.top, null); - mSurfaceX = w.mShownFrame.left; - mSurfaceY = w.mShownFrame.top; - mSurface.setPosition(w.mShownFrame.left, w.mShownFrame.top); + "POS " + left + ", " + top, null); + mSurfaceX = left; + mSurfaceY = top; + mSurface.setPosition(left, top); } catch (RuntimeException e) { Slog.w(TAG, "Error positioning surface of " + w - + " pos=(" + w.mShownFrame.left - + "," + w.mShownFrame.top + ")", e); + + " pos=(" + left + + "," + top + ")", e); if (!recoveringMemory) { mService.reclaimSomeSurfaceMemoryLocked(this, "position", true); } @@ -1177,12 +1178,7 @@ class WindowStateAnimator { // will do an animation to reveal it from behind the // starting window, so there is no need for it to also // be doing its own stuff. - if (mAnimation != null) { - mAnimation.cancel(); - mAnimation = null; - // Make sure we clean up the animation. - mAnimating = true; - } + clearAnimation(); mService.mFinishedStarting.add(mWin.mAppToken); mService.mH.sendEmptyMessage(H.FINISHED_STARTING); } @@ -1286,6 +1282,7 @@ class WindowStateAnimator { if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG, "applyAnimation: win=" + this + " anim=" + anim + " attr=0x" + Integer.toHexString(attr) + + " a=" + a + " mAnimation=" + mAnimation + " isEntrance=" + isEntrance); if (a != null) { |