Re-initialize the brightness slider when out of sync.

Whenever the brightness controller stops listening to brightness events,
it could get out of sync and so will animate when next opened and it
re-registers. We want to avoid this animation since it looks odd to the
user so we always re-initialize whenever we might get out of sync.

Bug: 72635553
Test: manual
Change-Id: I3a7e05e18652af33511a5de5a8ebeee01d2f0349
(cherry picked from commit a72faf947f3efe23543d7cead4451641456e6ec9)
diff --git a/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java
index 15e92f4..406eef8 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java
@@ -81,7 +81,7 @@
     private volatile boolean mIsVrModeEnabled;
     private boolean mListening;
     private boolean mExternalChange;
-    private boolean mControlInitialized;
+    private boolean mControlValueInitialized;
 
     private ValueAnimator mSliderAnimator;
 
@@ -337,6 +337,7 @@
 
         mBackgroundHandler.post(mStopListeningRunnable);
         mListening = false;
+        mControlValueInitialized = false;
     }
 
     @Override
@@ -428,10 +429,10 @@
     }
 
     private void animateSliderTo(int target) {
-        if (!mControlInitialized) {
+        if (!mControlValueInitialized) {
             // Don't animate the first value since it's default state isn't meaningful to users.
             mControl.setValue(target);
-            mControlInitialized = true;
+            mControlValueInitialized = true;
         }
         if (mSliderAnimator != null && mSliderAnimator.isStarted()) {
             mSliderAnimator.cancel();