Set backlight brightness in correct order.
Disable backlight before turning off the screen.
Enable backlight after turning on the screen.
Bug: 7016215
Change-Id: Idb763f85f7a40e852483c57e0a0d1b27eb943f08
diff --git a/services/java/com/android/server/power/DisplayPowerState.java b/services/java/com/android/server/power/DisplayPowerState.java
index 3524a08..1bd7811 100644
--- a/services/java/com/android/server/power/DisplayPowerState.java
+++ b/services/java/com/android/server/power/DisplayPowerState.java
@@ -239,6 +239,7 @@
private void apply() {
if (mDirty != 0) {
if ((mDirty & DIRTY_SCREEN_ON) != 0 && !mScreenOn) {
+ mScreenBrightnessModulator.setBrightness(0, true /*sync*/);
PowerManagerService.nativeSetScreenState(false);
}
@@ -246,15 +247,16 @@
mElectronBeam.draw(mElectronBeamLevel);
}
- if ((mDirty & (DIRTY_BRIGHTNESS | DIRTY_SCREEN_ON | DIRTY_ELECTRON_BEAM)) != 0) {
- mScreenBrightnessModulator.setBrightness(mScreenOn ?
- (int)(mScreenBrightness * mElectronBeamLevel) : 0);
- }
-
if ((mDirty & DIRTY_SCREEN_ON) != 0 && mScreenOn) {
PowerManagerService.nativeSetScreenState(true);
}
+ if ((mDirty & (DIRTY_BRIGHTNESS | DIRTY_SCREEN_ON | DIRTY_ELECTRON_BEAM)) != 0
+ && mScreenOn) {
+ mScreenBrightnessModulator.setBrightness(
+ (int)(mScreenBrightness * mElectronBeamLevel), false /*sync*/);
+ }
+
mDirty = 0;
if (mCleanListener != null) {