Merge "Only update the display when brightness and state are valid." into sc-dev am: 10db7a419c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15557295 Change-Id: I6bb57b8f7a45d6ea9c4a0e7957f9d0884b61a417
This commit is contained in:
@@ -411,7 +411,7 @@ final class DisplayPowerState {
|
|||||||
* Updates the state of the screen and backlight asynchronously on a separate thread.
|
* Updates the state of the screen and backlight asynchronously on a separate thread.
|
||||||
*/
|
*/
|
||||||
private final class PhotonicModulator extends 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 static final float INITIAL_BACKLIGHT_FLOAT = PowerManager.BRIGHTNESS_INVALID_FLOAT;
|
||||||
|
|
||||||
private final Object mLock = new Object();
|
private final Object mLock = new Object();
|
||||||
@@ -494,7 +494,9 @@ final class DisplayPowerState {
|
|||||||
if (!backlightChanged) {
|
if (!backlightChanged) {
|
||||||
mBacklightChangeInProgress = false;
|
mBacklightChangeInProgress = false;
|
||||||
}
|
}
|
||||||
if (!stateChanged && !backlightChanged) {
|
boolean valid = state != Display.STATE_UNKNOWN && !Float.isNaN(brightnessState);
|
||||||
|
boolean changed = stateChanged || backlightChanged;
|
||||||
|
if (!valid || !changed) {
|
||||||
try {
|
try {
|
||||||
mLock.wait();
|
mLock.wait();
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user