From 3a67f35f5e912b9c1ec44adbdc5531427318b12d Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Mon, 7 May 2012 11:21:33 -0700 Subject: [PATCH] Change DimAnimator to reflect rotations. Enlarge DimAnimator to cover corners when frozen surface rotates. Update DimAnimator size following rotation to reflect new dimensions. Fixes bug 6449788. Fixes bug 6449035. Change-Id: I217d7c96af940e6affc395b79dc665d00318b18c --- services/java/com/android/server/wm/DimAnimator.java | 11 ++++++++--- .../com/android/server/wm/WindowStateAnimator.java | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/services/java/com/android/server/wm/DimAnimator.java b/services/java/com/android/server/wm/DimAnimator.java index f9f9d1a51cfc9..e8f56c8859968 100644 --- a/services/java/com/android/server/wm/DimAnimator.java +++ b/services/java/com/android/server/wm/DimAnimator.java @@ -68,8 +68,10 @@ class DimAnimator { * {@link #updateSurface} after all windows are examined. */ void updateParameters(final Resources res, final Parameters params, final long currentTime) { - final int dw = params.mDimWidth; - final int dh = params.mDimHeight; + // Multiply by 1.5 so that rotating a frozen surface that includes this does not expose a + // corner. + final int dw = (int) (params.mDimWidth * 1.5); + final int dh = (int) (params.mDimHeight * 1.5); final WindowStateAnimator winAnimator = params.mDimWinAnimator; final float target = params.mDimTarget; if (!mDimShown) { @@ -79,7 +81,8 @@ class DimAnimator { try { mLastDimWidth = dw; mLastDimHeight = dh; - mDimSurface.setPosition(0, 0); + // back off position so mDimXXX/4 is before and mDimXXX/4 is after + mDimSurface.setPosition(-1 * dw / 6, -1 * dh /6); mDimSurface.setSize(dw, dh); mDimSurface.show(); } catch (RuntimeException e) { @@ -89,6 +92,8 @@ class DimAnimator { mLastDimWidth = dw; mLastDimHeight = dh; mDimSurface.setSize(dw, dh); + // back off position so mDimXXX/4 is before and mDimXXX/4 is after + mDimSurface.setPosition(-1 * dw / 6, -1 * dh /6); } mDimSurface.setLayer(winAnimator.mAnimLayer - WindowManagerService.LAYER_OFFSET_DIM); diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java index 2e3833249d04a..4f08d92af3dbb 100644 --- a/services/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/java/com/android/server/wm/WindowStateAnimator.java @@ -951,6 +951,10 @@ class WindowStateAnimator { mSurface.setSize(width, height); mAnimator.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; + if ((w.mAttrs.flags & LayoutParams.FLAG_DIM_BEHIND) != 0) { + mAnimator.startDimming(this, w.mExiting ? 0 : w.mAttrs.dimAmount, + mService.mAppDisplayWidth, mService.mAppDisplayHeight); + } } catch (RuntimeException e) { // If something goes wrong with the surface (such // as running out of memory), don't take down the