diff options
| author | 2017-04-25 12:30:49 +0200 | |
|---|---|---|
| committer | 2017-05-02 08:12:01 +0000 | |
| commit | 4f4939fb0468924a2d40e65a5bf78c3750d6589a (patch) | |
| tree | 9c95e83d1134018bff6c50c903747060666ba3ea | |
| parent | 3a8ad81ab42f030526cdf54d59a170d74478993e (diff) | |
Force a light to be set for the first time
The check in LightImpl::setLightLocked skips HAL call if light
parameters aren't changed. During initialization these parameters
are zeroed, thus it's not possible to turn the light off at the
startup.
As an example this fixes the issue with "stuck" battery light
in the following scenario:
1. Device has secure start-up option set (either pin or pattern).
2. Charger is connected at the startup and battery light shows the
charging state on pin or pattern prompt.
3. Device is unlocked and charger disconnected after some time,
e.g. after com.android.server.lights.LightsService restarted.
4. The battery light is not off and stuck in the previous state
until charger is connected / disconnected again.
Bug: 37662368
Test: manual - follow the above step-by-step
Change-Id: I45470e945fe4d26d37a5641dfff3311968f51ee4
| -rw-r--r-- | services/core/java/com/android/server/lights/LightsService.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java index eead11464d64..6d64b1234e17 100644 --- a/services/core/java/com/android/server/lights/LightsService.java +++ b/services/core/java/com/android/server/lights/LightsService.java @@ -129,10 +129,11 @@ public class LightsService extends SystemService { brightnessMode = mLastBrightnessMode; } - if ((color != mColor || mode != mMode || onMS != mOnMS || offMS != mOffMS || - mBrightnessMode != brightnessMode)) { + if (!mInitialized || color != mColor || mode != mMode || onMS != mOnMS || + offMS != mOffMS || mBrightnessMode != brightnessMode) { if (DEBUG) Slog.v(TAG, "setLight #" + mId + ": color=#" + Integer.toHexString(color) + ": brightnessMode=" + brightnessMode); + mInitialized = true; mLastColor = mColor; mColor = color; mMode = mode; @@ -164,6 +165,7 @@ public class LightsService extends SystemService { private int mLastColor; private boolean mVrModeEnabled; private boolean mUseLowPersistenceForVR; + private boolean mInitialized; } public LightsService(Context context) { |