Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b42ab0f4 authored by Mike Lockwood's avatar Mike Lockwood
Browse files

Delay setting initial screen brightness until after the sensors are initialized.



Some devices will not activate the light sensor properly on boot
unless we do this.

Change-Id: Ia27b6fc2d515c31eb8597e1d52127d70e2643bd7
BUG: 2269307

Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
parent 01f4385d
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -557,14 +557,6 @@ class PowerManagerService extends IPowerManager.Stub
            });
        updateSettingsValues();

        if (mUseSoftwareAutoBrightness) {
            // turn the screen on
            setPowerState(SCREEN_BRIGHT);
        } else {
            // turn everything on
            setPowerState(ALL_BRIGHT);
        }

        synchronized (mHandlerThread) {
            mInitComplete = true;
            mHandlerThread.notifyAll();
@@ -2486,9 +2478,21 @@ class PowerManagerService extends IPowerManager.Stub
            enableLightSensor(true);
        }

        // wait until sensors are enabled before turning on screen.
        // some devices will not activate the light sensor properly on boot
        // unless we do this.
        if (mUseSoftwareAutoBrightness) {
            // turn the screen on
            setPowerState(SCREEN_BRIGHT);
        } else {
            // turn everything on
            setPowerState(ALL_BRIGHT);
        }

        synchronized (mLocks) {
            Slog.d(TAG, "system ready!");
            mDoneBooting = true;

            long identity = Binder.clearCallingIdentity();
            try {
                mBatteryStats.noteScreenBrightness(getPreferredBrightness());