Loading packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java +12 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ import java.util.concurrent.Executor; public class BrightnessController implements ToggleSlider.Listener, MirroredBrightnessController { private static final String TAG = "CentralSurfaces.BrightnessController"; private static final int SLIDER_ANIMATION_DURATION = 1000; private static final int SLIDER_ANIMATION_DURATION = 3000; private static final int MSG_UPDATE_SLIDER = 1; private static final int MSG_ATTACH_LISTENER = 2; Loading Loading @@ -96,6 +96,7 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig }; private volatile boolean mAutomatic; // Brightness adjusted automatically using ambient light. private boolean mTrackingTouch = false; // Brightness adjusted via touch events. private volatile boolean mIsVrModeEnabled; private boolean mListening; private boolean mExternalChange; Loading Loading @@ -330,6 +331,7 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig @Override public void onChanged(boolean tracking, int value, boolean stopTracking) { mTrackingTouch = tracking; if (mExternalChange) return; if (mSliderAnimator != null) { Loading Loading @@ -396,6 +398,12 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig } } private boolean triggeredByBrightnessKey() { // When the brightness mode is manual and the user isn't changing the brightness via the // brightness slider, assume changes are coming from a brightness key. return !mAutomatic && !mTrackingTouch; } private void updateSlider(float brightnessValue, boolean inVrMode) { final float min = mBrightnessMin; final float max = mBrightnessMax; Loading @@ -417,12 +425,13 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig } private void animateSliderTo(int target) { if (!mControlValueInitialized || !mControl.isVisible()) { if (!mControlValueInitialized || !mControl.isVisible() || triggeredByBrightnessKey()) { // Don't animate the first value since its default state isn't meaningful to users. // We also don't want to animate slider if it's not visible - especially important when // two sliders are active at the same time in split shade (one in QS and one in QQS), // as this negatively affects transition between them and they share mirror slider - // animating it from two different sources causes janky motion // animating it from two different sources causes janky motion. // Don't animate if the value is changed via the brightness keys of a keyboard. mControl.setValue(target); mControlValueInitialized = true; } Loading Loading
packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java +12 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ import java.util.concurrent.Executor; public class BrightnessController implements ToggleSlider.Listener, MirroredBrightnessController { private static final String TAG = "CentralSurfaces.BrightnessController"; private static final int SLIDER_ANIMATION_DURATION = 1000; private static final int SLIDER_ANIMATION_DURATION = 3000; private static final int MSG_UPDATE_SLIDER = 1; private static final int MSG_ATTACH_LISTENER = 2; Loading Loading @@ -96,6 +96,7 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig }; private volatile boolean mAutomatic; // Brightness adjusted automatically using ambient light. private boolean mTrackingTouch = false; // Brightness adjusted via touch events. private volatile boolean mIsVrModeEnabled; private boolean mListening; private boolean mExternalChange; Loading Loading @@ -330,6 +331,7 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig @Override public void onChanged(boolean tracking, int value, boolean stopTracking) { mTrackingTouch = tracking; if (mExternalChange) return; if (mSliderAnimator != null) { Loading Loading @@ -396,6 +398,12 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig } } private boolean triggeredByBrightnessKey() { // When the brightness mode is manual and the user isn't changing the brightness via the // brightness slider, assume changes are coming from a brightness key. return !mAutomatic && !mTrackingTouch; } private void updateSlider(float brightnessValue, boolean inVrMode) { final float min = mBrightnessMin; final float max = mBrightnessMax; Loading @@ -417,12 +425,13 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig } private void animateSliderTo(int target) { if (!mControlValueInitialized || !mControl.isVisible()) { if (!mControlValueInitialized || !mControl.isVisible() || triggeredByBrightnessKey()) { // Don't animate the first value since its default state isn't meaningful to users. // We also don't want to animate slider if it's not visible - especially important when // two sliders are active at the same time in split shade (one in QS and one in QQS), // as this negatively affects transition between them and they share mirror slider - // animating it from two different sources causes janky motion // animating it from two different sources causes janky motion. // Don't animate if the value is changed via the brightness keys of a keyboard. mControl.setValue(target); mControlValueInitialized = true; } Loading