diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java index d7d1de00c82dd..991a68fb056a0 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java +++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java @@ -398,6 +398,11 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig min = mBrightnessMin; max = mBrightnessMax; } + + // Ensure the slider is in a fixed position first, then check if we should animate. + if (mSliderAnimator != null && mSliderAnimator.isStarted()) { + mSliderAnimator.cancel(); + } // convertGammaToLinearFloat returns 0-1 if (BrightnessSynchronizer.floatEquals(brightnessValue, convertGammaToLinearFloat(mControl.getValue(), min, max))) { @@ -420,9 +425,6 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig mControl.setValue(target); mControlValueInitialized = true; } - if (mSliderAnimator != null && mSliderAnimator.isStarted()) { - mSliderAnimator.cancel(); - } mSliderAnimator = ValueAnimator.ofInt(mControl.getValue(), target); mSliderAnimator.addUpdateListener((ValueAnimator animation) -> { mExternalChange = true;