summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2021-08-14 00:19:12 +0100
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-09-01 02:13:50 +0000
commitb2ae678dda2d1e202ca335a17932805d864e18dc (patch)
treec86ec48d185746893c049bfcbee367f1b776567f
parente9d071e8333db88a8f81b0fcd21f5f18a3ae8222 (diff)
downloadbase-b2ae678dda2d1e202ca335a17932805d864e18dc.tar.gz
Only update the display when brightness and state are valid.
If either are invalid then we're in an indeterminant state and need to wait until that's resolved. This should only happens at boot and then is immediately corrected when we set our initial desired state. By not checking the validity of the to-be-applied state, we're actually turning the display to our assumed state briefly (i.e. OFF) even though we don't know what state we actually want yet. Fixes: 196566901 Fixes: 196274559 Fixes: 195071558 Test: Reboot device, no flicker in boot animation Change-Id: Ie5a4c186e3af31eb8810f5c7014a4e2cc7cdbf91 (cherry picked from commit a00cda677956e0553a6de4df8f25ebc9b2b3039e)
-rw-r--r--services/core/java/com/android/server/display/DisplayPowerState.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/display/DisplayPowerState.java b/services/core/java/com/android/server/display/DisplayPowerState.java
index 6af192371e3d..147050cd271f 100644
--- a/services/core/java/com/android/server/display/DisplayPowerState.java
+++ b/services/core/java/com/android/server/display/DisplayPowerState.java
@@ -411,7 +411,7 @@ final class DisplayPowerState {
* Updates the state of the screen and backlight asynchronously on a separate thread.
*/
private final class PhotonicModulator extends Thread {
- private static final int INITIAL_SCREEN_STATE = Display.STATE_OFF; // unknown, assume off
+ private static final int INITIAL_SCREEN_STATE = Display.STATE_UNKNOWN;
private static final float INITIAL_BACKLIGHT_FLOAT = PowerManager.BRIGHTNESS_INVALID_FLOAT;
private final Object mLock = new Object();
@@ -494,7 +494,9 @@ final class DisplayPowerState {
if (!backlightChanged) {
mBacklightChangeInProgress = false;
}
- if (!stateChanged && !backlightChanged) {
+ boolean valid = state != Display.STATE_UNKNOWN && !Float.isNaN(brightnessState);
+ boolean changed = stateChanged || backlightChanged;
+ if (!valid || !changed) {
try {
mLock.wait();
} catch (InterruptedException ex) {