Set initial screen brightness earlier in the boot process.
Previously we had to wait for systemReady before setting the brightness
due to the order in which the display power controller was initialized.
Unfortunately it could take us a rather long time to reach that stage,
particularly after an OTA where the screen would remain at maximum
brightness for minutes while "Optimizing Apps".
This change moves the brightness backlight setting code deeper
into the display manager which has a couple of nice side-benefits
in that it now becomes much easier to coordinate display power mode
changes with display backlight changes. So this change also resolves
some issued with changing the backlight while in DOZE_SUSPEND and
ensuring that backlight changes generally end up being performed
before executing a power mode change except in the case where the
display needs to come out of suspend first. (So now the backlight
will be set before entering DOZE from the ON state.)
Deleted some dead code in LightService which was in the way.
Bug: 19029490
Change-Id: I494b5223e676248daf2ff8be3ec338845977f73c
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 53da75b..593853c 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -325,6 +325,9 @@
// initialize power management features.
mActivityManagerService.initPowerManagement();
+ // Manages LEDs and display backlight so we need it to bring up the display.
+ mSystemServiceManager.startService(LightsService.class);
+
// Display manager is needed to provide display metrics before package manager
// starts up.
mDisplayManagerService = mSystemServiceManager.startService(DisplayManagerService.class);
@@ -363,9 +366,6 @@
* Starts some essential services that are not tangled up in the bootstrap process.
*/
private void startCoreServices() {
- // Manages LEDs and display backlight.
- mSystemServiceManager.startService(LightsService.class);
-
// Tracks the battery level. Requires LightService.
mSystemServiceManager.startService(BatteryService.class);