diff options
-rw-r--r-- | services/java/com/android/server/power/DisplayPowerState.java | 10 | ||||
-rw-r--r-- | services/java/com/android/server/power/PowerManagerService.java | 9 |
2 files changed, 16 insertions, 3 deletions
diff --git a/services/java/com/android/server/power/DisplayPowerState.java b/services/java/com/android/server/power/DisplayPowerState.java index 64a0462c3aea..3524a08efd6a 100644 --- a/services/java/com/android/server/power/DisplayPowerState.java +++ b/services/java/com/android/server/power/DisplayPowerState.java @@ -49,8 +49,6 @@ final class DisplayPowerState { private static final int DIRTY_ELECTRON_BEAM = 1 << 1; private static final int DIRTY_BRIGHTNESS = 1 << 2; - private static final int DIRTY_ALL = 0xffffffff; - private final Choreographer mChoreographer; private final ElectronBeam mElectronBeam; private final PhotonicModulator mScreenBrightnessModulator; @@ -68,10 +66,16 @@ final class DisplayPowerState { mElectronBeam = electronBean; mScreenBrightnessModulator = screenBrightnessModulator; + // At boot time, we know that the screen is on and the electron beam + // animation is not playing. We don't know the screen's brightness though, + // so prepare to set it to a known state when the state is next applied. + // Although we set the brightness to full on here, the display power controller + // will reset the brightness to a new level immediately before the changes + // actually have a chance to be applied. mScreenOn = true; mElectronBeamLevel = 1.0f; mScreenBrightness = PowerManager.BRIGHTNESS_ON; - invalidate(DIRTY_ALL); + invalidate(DIRTY_BRIGHTNESS); } public static final FloatProperty<DisplayPowerState> ELECTRON_BEAM_LEVEL = diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java index 9f2b247d3106..dc900ca57b18 100644 --- a/services/java/com/android/server/power/PowerManagerService.java +++ b/services/java/com/android/server/power/PowerManagerService.java @@ -296,6 +296,7 @@ public final class PowerManagerService extends IPowerManager.Stub } nativeInit(); + nativeSetPowerState(true, true); } /** @@ -305,6 +306,14 @@ public final class PowerManagerService extends IPowerManager.Stub public void init(Context context, LightsService ls, ActivityManagerService am, BatteryService bs, IBatteryStats bss, DisplayManagerService dm) { + // Forcibly turn the screen on at boot so that it is in a known power state. + // We do this in init() rather than in the constructor because setting the + // screen state requires a call into surface flinger which then needs to call back + // into the activity manager to check permissions. Unfortunately the + // activity manager is not running when the constructor is called, so we + // have to defer setting the screen state until this point. + nativeSetScreenState(true); + mContext = context; mLightsService = ls; mBatteryService = bs; |