From 0b388d4a368e8503411450504c6e3d39952bce16 Mon Sep 17 00:00:00 2001 From: Filip Gruszczynski Date: Mon, 27 Jul 2015 15:28:29 -0700 Subject: [PATCH] Don't animate burn-in return when it wasn't applied. The burn-in protection return animation is performed based on the last offset that was used, but it doesn't mean that such offset is currently applied. Right after entering ambient mode no offset is applied, so if we start a return animation using the last applied offset, it will cause a shake. The animation will first shift from 0, 0 offset to the last offset and then return again to 0, 0. This CL makes it not apply the animation in that case. Bug: 22519478 Change-Id: I5cb750b56e9715c6d9389136071a5e0fbafb047b --- .../internal/policy/impl/BurnInProtectionHelper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/policy/src/com/android/internal/policy/impl/BurnInProtectionHelper.java b/policy/src/com/android/internal/policy/impl/BurnInProtectionHelper.java index 11c739cc5c54e..8cc3661af9e1e 100644 --- a/policy/src/com/android/internal/policy/impl/BurnInProtectionHelper.java +++ b/policy/src/com/android/internal/policy/impl/BurnInProtectionHelper.java @@ -56,6 +56,9 @@ public class BurnInProtectionHelper implements DisplayManager.DisplayListener, /* 1 means increasing, -1 means decreasing */ private int mYOffsetDirection = 1; + private int mAppliedBurnInXOffset = 0; + private int mAppliedBurnInYOffset = 0; + private final AlarmManager mAlarmManager; private final PendingIntent mBurnInProtectionIntent; private final DisplayManagerInternal mDisplayManagerInternal; @@ -123,6 +126,8 @@ public class BurnInProtectionHelper implements DisplayManager.DisplayListener, mFirstUpdate = false; } else { adjustOffsets(); + mAppliedBurnInXOffset = mLastBurnInXOffset; + mAppliedBurnInYOffset = mLastBurnInYOffset; mDisplayManagerInternal.setDisplayOffsets(mDisplay.getDisplayId(), mLastBurnInXOffset, mLastBurnInYOffset); } @@ -242,6 +247,8 @@ public class BurnInProtectionHelper implements DisplayManager.DisplayListener, @Override public void onAnimationEnd(Animator animator) { if (animator == mCenteringAnimator && !mBurnInProtectionActive) { + mAppliedBurnInXOffset = 0; + mAppliedBurnInYOffset = 0; // No matter how the animation finishes, we want to zero the offsets. mDisplayManagerInternal.setDisplayOffsets(mDisplay.getDisplayId(), 0, 0); } @@ -260,7 +267,7 @@ public class BurnInProtectionHelper implements DisplayManager.DisplayListener, if (!mBurnInProtectionActive) { final float value = (Float) valueAnimator.getAnimatedValue(); mDisplayManagerInternal.setDisplayOffsets(mDisplay.getDisplayId(), - (int) (mLastBurnInXOffset * value), (int) (mLastBurnInYOffset * value)); + (int) (mAppliedBurnInXOffset * value), (int) (mAppliedBurnInYOffset * value)); } } }