From 52d7572cc25383b79041e285bc34a9e1a884b062 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Thu, 28 Jul 2016 05:51:11 -0700 Subject: 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 --- .../core/java/com/android/server/lights/LightsService.java | 4 +++- .../java/com/android/server/wm/WindowManagerService.java | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'services') diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java index 16dde26..d4762bd 100644 --- a/services/core/java/com/android/server/lights/LightsService.java +++ b/services/core/java/com/android/server/lights/LightsService.java @@ -113,9 +113,10 @@ public class LightsService extends SystemService { private void setLightLocked(int color, int mode, int onMS, int offMS, int brightnessMode) { if (mModesUpdate || color != mColor || mode != mMode || onMS != mOnMS || - offMS != mOffMS) { + offMS != mOffMS || mReset) { if (DEBUG) Slog.v(TAG, "setLight #" + mId + ": color=#" + Integer.toHexString(color)); + mReset = false; mColor = color; mMode = mode; mOnMS = onMS; @@ -141,6 +142,7 @@ public class LightsService extends SystemService { private boolean mFlashing; private boolean mModesUpdate; private boolean mMultipleLeds; + private boolean mReset = true; } public LightsService(Context context) { diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 6f44911..c519120 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -128,6 +128,8 @@ import com.android.server.UiThread; import com.android.server.Watchdog; import com.android.server.am.BatteryStatsService; 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; @@ -5928,6 +5930,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); } -- cgit v1.1