diff options
author | Craig Mautner <cmautner@google.com> | 2012-11-29 09:57:14 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-11-29 09:57:15 -0800 |
commit | 24d966a3b6a0407076b333ec2e074160b2311cb2 (patch) | |
tree | c813ae76c74c92fa3467a0c6c6441e223b3a2a24 /services/java | |
parent | 652678af4d18b9a6c18ce6a860de01d958bc82fe (diff) | |
parent | 9dd9e0c99dcb2db98ffbcf9ad97e58fab8d38640 (diff) | |
download | frameworks_base-24d966a3b6a0407076b333ec2e074160b2311cb2.zip frameworks_base-24d966a3b6a0407076b333ec2e074160b2311cb2.tar.gz frameworks_base-24d966a3b6a0407076b333ec2e074160b2311cb2.tar.bz2 |
Merge "Fix math errors causing black screen. DO NOT MERGE" into jb-mr1.1-dev
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/power/RampAnimator.java | 18 | ||||
-rwxr-xr-x | services/java/com/android/server/wm/WindowManagerService.java | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/services/java/com/android/server/power/RampAnimator.java b/services/java/com/android/server/power/RampAnimator.java index 6f063c3..4a4f080 100644 --- a/services/java/com/android/server/power/RampAnimator.java +++ b/services/java/com/android/server/power/RampAnimator.java @@ -102,20 +102,26 @@ final class RampAnimator<T> { final long frameTimeNanos = mChoreographer.getFrameTimeNanos(); final float timeDelta = (frameTimeNanos - mLastFrameTimeNanos) * 0.000000001f; - final float amount = timeDelta * mRate / ValueAnimator.getDurationScale(); mLastFrameTimeNanos = frameTimeNanos; // Advance the animated value towards the target at the specified rate // and clamp to the target. This gives us the new current value but // we keep the animated value around to allow for fractional increments // towards the target. - int oldCurrentValue = mCurrentValue; - if (mTargetValue > mCurrentValue) { - mAnimatedValue = Math.min(mAnimatedValue + amount, mTargetValue); + final float scale = ValueAnimator.getDurationScale(); + if (scale == 0) { + // Animation off. + mAnimatedValue = mTargetValue; } else { - mAnimatedValue = Math.max(mAnimatedValue - amount, mTargetValue); + final float amount = timeDelta * mRate / scale; + if (mTargetValue > mCurrentValue) { + mAnimatedValue = Math.min(mAnimatedValue + amount, mTargetValue); + } else { + mAnimatedValue = Math.max(mAnimatedValue - amount, mTargetValue); + } } - mCurrentValue = (int)Math.round(mAnimatedValue); + final int oldCurrentValue = mCurrentValue; + mCurrentValue = Math.round(mAnimatedValue); if (oldCurrentValue != mCurrentValue) { mProperty.setValue(mObject, mCurrentValue); diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index c3fc19c..d0ab917 100755 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -821,7 +821,7 @@ public class WindowManagerService extends IWindowManager.Stub mTransitionAnimationScale = Settings.Global.getFloat(context.getContentResolver(), Settings.Global.TRANSITION_ANIMATION_SCALE, mTransitionAnimationScale); setAnimatorDurationScale(Settings.Global.getFloat(context.getContentResolver(), - Settings.Global.ANIMATOR_DURATION_SCALE, mTransitionAnimationScale)); + Settings.Global.ANIMATOR_DURATION_SCALE, mAnimatorDurationScale)); // Track changes to DevicePolicyManager state so we can enable/disable keyguard. IntentFilter filter = new IntentFilter(); |