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

Commit f42f15cf authored by Eric Olsen's avatar Eric Olsen
Browse files

Add support for colored LED on jogball backlight.



Signed-off-by: default avatarEric Olsen <eolsen@android.com>
parent 5fc71e67
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -30,6 +30,6 @@ interface IHardwareService
    void enableCameraFlash(int milliseconds);

    // for the phone
    void setAttentionLight(boolean on);
    void setAttentionLight(boolean on, int color);
}
+23 −16
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public class HardwareService extends IHardwareService.Stub {

    static final int LIGHT_FLASH_NONE = 0;
    static final int LIGHT_FLASH_TIMED = 1;
    static final int LIGHT_FLASH_HARDWARE = 2;

    private final LinkedList<Vibration> mVibrations;
    private Vibration mCurrentVibration;
@@ -282,13 +283,19 @@ public class HardwareService extends IHardwareService.Stub {
        setLight_native(mNativePointer, light, color, mode, onMS, offMS);
    }

    public void setAttentionLight(boolean on) {
    void setAutoBrightness_UNCHECKED(boolean on) {
        if (mAutoBrightnessAvailable) {
            setAutoBrightness_native(mNativePointer, on);
        }
    }

    public void setAttentionLight(boolean on, int color) {
        // Not worthy of a permission.  We shouldn't have a flashlight permission.
        synchronized (this) {
            mAttentionLightOn = on;
            mPulsing = false;
            setLight_native(mNativePointer, LIGHT_ID_ATTENTION, on ? 0xffffffff : 0,
                    LIGHT_FLASH_NONE, 0, 0);
            setLight_native(mNativePointer, LIGHT_ID_ATTENTION, color,
                    LIGHT_FLASH_HARDWARE, on ? 3 : 0, 0);
        }
    }

@@ -302,8 +309,8 @@ public class HardwareService extends IHardwareService.Stub {
            }
            if (!mAttentionLightOn && !mPulsing) {
                mPulsing = true;
                setLight_native(mNativePointer, LIGHT_ID_ATTENTION, 0xff101010,
                        LIGHT_FLASH_NONE, 0, 0);
                setLight_native(mNativePointer, LIGHT_ID_ATTENTION, 0x00ffffff,
                        LIGHT_FLASH_HARDWARE, 7, 0);
                mH.sendMessageDelayed(Message.obtain(mH, 1), 3000);
            }
        }