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

Commit 03f21176 authored by Steve Kondik's avatar Steve Kondik
Browse files

lights: Make sure the lights are out

 * Annoying situation where the battery charging LED comes on in
   the crypto startup screen, but never gets turned off because
   of caching.
 * Explicitly turn off LEDs after the bootanimation completes, and
   always set the full state to the hardware on the first call
   regardless if it's all zeros.

Change-Id: I8cd2325ec5d8924391e4fc62249f6dd737d52f3e
parent 328e41af
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ public class LightsService extends SystemService {
                if (DEBUG) Slog.v(TAG, "setLight #" + mId + ": color=#"
                        + Integer.toHexString(color) + ": brightnessMode=" + brightnessMode);
                mLastColor = mColor;
                mReset = false;
                mColor = color;
                mMode = mode;
                mOnMS = onMS;
@@ -173,6 +174,7 @@ public class LightsService extends SystemService {
        private boolean mLocked;
        private boolean mModesUpdate;
        private boolean mMultipleLeds;
        private boolean mReset = true;
    }

    public LightsService(Context context) {
+13 −0
Original line number Diff line number Diff line
@@ -139,6 +139,8 @@ import com.android.server.LocalServices;
import com.android.server.UiThread;
import com.android.server.Watchdog;
import com.android.server.input.InputManagerService;
import com.android.server.lights.Light;
import com.android.server.lights.LightsManager;
import com.android.server.policy.PhoneWindowManager;
import com.android.server.power.ShutdownThread;

@@ -5903,6 +5905,17 @@ public class WindowManagerService extends IWindowManager.Stub

        mPolicy.enableScreenAfterBoot();

        // clear any intrusive lighting which may still be on from the
        // crypto landing ui
        LightsManager lm = LocalServices.getService(LightsManager.class);
        Light batteryLight = lm.getLight(LightsManager.LIGHT_ID_BATTERY);
        Light notifLight = lm.getLight(LightsManager.LIGHT_ID_NOTIFICATIONS);
        if (batteryLight != null) {
            batteryLight.turnOff();
        }
        if (notifLight != null) {
            notifLight.turnOff();
        }
        // Make sure the last requested orientation has been applied.
        updateRotationUnchecked(false, false);
    }