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

Commit b0812423 authored by Scott Mertz's avatar Scott Mertz
Browse files

lights: fix notification and attention lights

- Turn off attention light in pulse rather than
  just turning flashing off.  This was causing
  the LED to be left on for any HAL that obeys
  the concept of LIGHT_FLASH_NONE.  Most HALs
  will either treat this as OFF, or have special
  handling for the attention LED case where
  it was getting left on.
- Remove some unnecessary code in Light

Change-Id: I36292ae0d57e0454d7c9f1d3c909a87affeaf7d2
parent 6fb6c3e4
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ public class LightsService {

        public void pulse(int color, int onMS) {
            synchronized (this) {
                if (mColor == 0 && !mFlashing) {
                if (mColor == 0) {
                    setLightLocked(color, LIGHT_FLASH_HARDWARE, onMS, 1000, BRIGHTNESS_MODE_USER);
                    mH.sendMessageDelayed(Message.obtain(mH, 1, this), onMS);
                }
@@ -110,12 +110,6 @@ public class LightsService {
            }
        }

        private void stopFlashing() {
            synchronized (this) {
                setLightLocked(mColor, LIGHT_FLASH_NONE, 0, 0, BRIGHTNESS_MODE_USER);
            }
        }

        private void setLightLocked(int color, int mode, int onMS, int offMS, int brightnessMode) {
            if (color != mColor || mode != mMode || onMS != mOnMS || offMS != mOffMS) {
                if (DEBUG) Slog.v(TAG, "setLight #" + mId + ": color=#"
@@ -133,7 +127,6 @@ public class LightsService {
        private int mMode;
        private int mOnMS;
        private int mOffMS;
        private boolean mFlashing;
    }

    /* This class implements an obsolete API that was removed after eclair and re-added during the
@@ -200,7 +193,7 @@ public class LightsService {
        @Override
        public void handleMessage(Message msg) {
            Light light = (Light)msg.obj;
            light.stopFlashing();
            light.turnOff();
        }
    };