Add new config to tell us whether brightness is bucketed or continuous
If we know brightness is bucketed rather than continuous, then we skip
the brightness animation and just go straight to the expected brightness
level.
Bug: 64007419
Test: manual
Merged-In: I2ac0c5f45cc2ec1e758bb84a29d2ecda2c6d5b0d
Change-Id: I2ac0c5f45cc2ec1e758bb84a29d2ecda2c6d5b0d
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 4ffdc6a..728f390 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1857,6 +1857,9 @@
<!-- Whether the display blanks itself when transitioning from a doze to a non-doze state -->
<bool name="config_displayBlanksAfterDoze">false</bool>
+ <!-- True if the display hardware only has brightness buckets rather than a full range of
+ backlight values -->
+ <bool name="config_displayBrightnessBucketsInDoze">false</bool>
<!-- Power Management: Specifies whether to decouple the auto-suspend state of the
device from the display on/off state.
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index c0bc1d2..29ee3c4 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3053,6 +3053,7 @@
<java-symbol type="integer" name="config_inCallNotificationVolumeRelative" />
<java-symbol type="bool" name="config_dozeAlwaysOnDisplayAvailable" />
<java-symbol type="bool" name="config_displayBlanksAfterDoze" />
+ <java-symbol type="bool" name="config_displayBrightnessBucketsInDoze" />
<java-symbol type="integer" name="config_storageManagerDaystoRetainDefault" />
<java-symbol type="string" name="config_headlineFontFamily" />
<java-symbol type="string" name="config_headlineFontFamilyLight" />
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index e858edb..6e6e7d1 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -171,6 +171,12 @@
// blank itself and begin an appropriate power on animation.
private boolean mDisplayBlanksAfterDozeConfig;
+ // True if there are only buckets of brightness values when the display is in the doze state,
+ // rather than a full range of values. If this is true, then we'll avoid animating the screen
+ // brightness since it'd likely be multiple jarring brightness transitions instead of just one
+ // to reach the final state.
+ private boolean mBrightnessBucketsInDozeConfig;
+
// The pending power request.
// Initially null until the first call to requestPowerState.
// Guarded by mLock.
@@ -419,6 +425,9 @@
mDisplayBlanksAfterDozeConfig = resources.getBoolean(
com.android.internal.R.bool.config_displayBlanksAfterDoze);
+ mBrightnessBucketsInDozeConfig = resources.getBoolean(
+ com.android.internal.R.bool.config_displayBrightnessBucketsInDoze);
+
if (!DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT) {
mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
if (mProximitySensor != null) {
@@ -780,7 +789,7 @@
boolean wasOrWillBeInVr = (state == Display.STATE_VR || oldState == Display.STATE_VR);
if ((state == Display.STATE_ON
&& mSkipRampState == RAMP_STATE_SKIP_NONE
- || state == Display.STATE_DOZE)
+ || state == Display.STATE_DOZE && !mBrightnessBucketsInDozeConfig)
&& !wasOrWillBeInVr) {
animateScreenBrightness(brightness,
slowChange ? mBrightnessRampRateSlow : mBrightnessRampRateFast);
diff --git a/services/core/java/com/android/server/display/DisplayPowerState.java b/services/core/java/com/android/server/display/DisplayPowerState.java
index 7b55ec1..efa4a1d 100644
--- a/services/core/java/com/android/server/display/DisplayPowerState.java
+++ b/services/core/java/com/android/server/display/DisplayPowerState.java
@@ -332,7 +332,7 @@
if (mColorFadePrepared) {
mColorFade.draw(mColorFadeLevel);
Trace.traceCounter(Trace.TRACE_TAG_POWER,
- COUNTER_COLOR_FADE, Math.round(mColorFadeLevel* 100));
+ COUNTER_COLOR_FADE, Math.round(mColorFadeLevel * 100));
}
mColorFadeReady = true;