diff options
author | tiger_huang <tiger_huang@htc.com> | 2015-04-27 20:36:46 +0800 |
---|---|---|
committer | Wale Ogunwale <ogunwale@google.com> | 2015-05-15 10:27:17 -0700 |
commit | b7f3f92ac200fb22cd8d880b63a5c0ef2bad5354 (patch) | |
tree | b861cad553187d3c698a199ea9440e05e3896a69 /services/core/java/com/android/server/wm | |
parent | 0c72f4f9d04077f2fe96b486b8501303325a54af (diff) | |
download | frameworks_base-b7f3f92ac200fb22cd8d880b63a5c0ef2bad5354.zip frameworks_base-b7f3f92ac200fb22cd8d880b63a5c0ef2bad5354.tar.gz frameworks_base-b7f3f92ac200fb22cd8d880b63a5c0ef2bad5354.tar.bz2 |
Use the correct parent size to initialize animations
The original logic would use out-of-date parent sizes to initialize
animations. If the screen size is changed after assigning mAnimDw and
mAnimDh in the constructor of WindowStateAnimator, the fromDeltaY
(in the most cases) of TranslateAnimation would be initialized
incorrectly.
In this change, we always use up-to-date parent sizes to initialize
animations to prevent the issue.
https://code.google.com/p/android/issues/detail?id=170348
Change-Id: Ib9c609121228934bdb463263feb1924eb389c1d2
Diffstat (limited to 'services/core/java/com/android/server/wm')
-rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerService.java | 1 | ||||
-rw-r--r-- | services/core/java/com/android/server/wm/WindowStateAnimator.java | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 4972ce4..ebec172 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -9973,6 +9973,7 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.setAnimation(a); winAnimator.mAnimDw = w.mLastFrame.left - left; winAnimator.mAnimDh = w.mLastFrame.top - top; + winAnimator.mAnimateMove = true; } //TODO (multidisplay): Accessibility supported only for the default display. diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index ec89b37..424e2e2 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -122,6 +122,7 @@ class WindowStateAnimator { // used. int mAnimDw; int mAnimDh; + boolean mAnimateMove = false; float mDsDx=1, mDtDx=0, mDsDy=0, mDtDy=1; float mLastDsDx=1, mLastDtDx=0, mLastDsDy=0, mLastDtDy=1; @@ -290,9 +291,15 @@ class WindowStateAnimator { " wh=" + mWin.mFrame.height() + " dw=" + mAnimDw + " dh=" + mAnimDh + " scale=" + mService.getWindowAnimationScaleLocked()); - mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(), - mAnimDw, mAnimDh); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); + if (mAnimateMove) { + mAnimateMove = false; + mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(), + mAnimDw, mAnimDh); + } else { + mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(), + displayInfo.appWidth, displayInfo.appHeight); + } mAnimDw = displayInfo.appWidth; mAnimDh = displayInfo.appHeight; mAnimation.setStartTime(mAnimationStartTime != -1 |