summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorCraig Mautner <cmautner@google.com>2012-11-29 09:57:14 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-11-29 09:57:15 -0800
commit24d966a3b6a0407076b333ec2e074160b2311cb2 (patch)
treec813ae76c74c92fa3467a0c6c6441e223b3a2a24 /services/java
parent652678af4d18b9a6c18ce6a860de01d958bc82fe (diff)
parent9dd9e0c99dcb2db98ffbcf9ad97e58fab8d38640 (diff)
downloadframeworks_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.java18
-rwxr-xr-xservices/java/com/android/server/wm/WindowManagerService.java2
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();