diff options
| author | tbalden <illespal@gmail.com> | 2013-03-31 18:33:53 +0200 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-04-13 02:11:01 -0700 |
| commit | 44e5f6caa3df6823984ac08ec45ebabbef199da7 (patch) | |
| tree | 731284a16dcd106943289f8ed295ac9cb679a573 /services/java | |
| parent | 651d219160460a539f96b2e5a8461152aac9e5e4 (diff) | |
| download | frameworks_base-44e5f6caa3df6823984ac08ec45ebabbef199da7.zip frameworks_base-44e5f6caa3df6823984ac08ec45ebabbef199da7.tar.gz frameworks_base-44e5f6caa3df6823984ac08ec45ebabbef199da7.tar.bz2 | |
keyboard: adding functional alt/shift lights
This is useful for devices that has QWERTY keyboard
and leds for the Alt/Shift (Fn/Caps) keys, like
htc doubleshot.
Depends on libhardware patch for the light ids:
http://review.cyanogenmod.org/34902
Change-Id: I66ebc2d881438f5b51db77eaa885421e65a7da0d
Diffstat (limited to 'services/java')
| -rw-r--r-- | services/java/com/android/server/LightsService.java | 4 | ||||
| -rw-r--r-- | services/java/com/android/server/power/PowerManagerService.java | 25 |
2 files changed, 28 insertions, 1 deletions
diff --git a/services/java/com/android/server/LightsService.java b/services/java/com/android/server/LightsService.java index 89bfcac..d5ea4f4 100644 --- a/services/java/com/android/server/LightsService.java +++ b/services/java/com/android/server/LightsService.java @@ -39,7 +39,9 @@ public class LightsService { public static final int LIGHT_ID_ATTENTION = 5; public static final int LIGHT_ID_BLUETOOTH = 6; public static final int LIGHT_ID_WIFI = 7; - public static final int LIGHT_ID_COUNT = 8; + public static final int LIGHT_ID_CAPS = 8; + public static final int LIGHT_ID_FUNC = 9; + public static final int LIGHT_ID_COUNT = 10; public static final int LIGHT_FLASH_NONE = 0; public static final int LIGHT_FLASH_TIMED = 1; diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java index 156c08f..e8f6b60 100644 --- a/services/java/com/android/server/power/PowerManagerService.java +++ b/services/java/com/android/server/power/PowerManagerService.java @@ -186,6 +186,8 @@ public final class PowerManagerService extends IPowerManager.Stub private LightsService.Light mAttentionLight; private LightsService.Light mButtonsLight; private LightsService.Light mKeyboardLight; + private LightsService.Light mCapsLight; + private LightsService.Light mFnLight; private final Object mLock = new Object(); @@ -455,6 +457,8 @@ public final class PowerManagerService extends IPowerManager.Stub mAttentionLight = mLightsService.getLight(LightsService.LIGHT_ID_ATTENTION); mButtonsLight = mLightsService.getLight(LightsService.LIGHT_ID_BUTTONS); mKeyboardLight = mLightsService.getLight(LightsService.LIGHT_ID_KEYBOARD); + mCapsLight = mLightsService.getLight(LightsService.LIGHT_ID_CAPS); + mFnLight = mLightsService.getLight(LightsService.LIGHT_ID_FUNC); // Register for broadcasts from other components of the system. IntentFilter filter = new IntentFilter(); @@ -901,11 +905,32 @@ public final class PowerManagerService extends IPowerManager.Stub } if (mKeyboardVisible != visible) { mKeyboardVisible = visible; + if (!visible) { + mKeyboardLight.turnOff(); + // If hiding keyboard, turn off leds + setKeyboardLight(false, 1); + setKeyboardLight(false, 2); + } } } } @Override // Binder call + public void setKeyboardLight(boolean on, int key) { + if (key == 1) { + if (on) + mCapsLight.setColor(0x00ffffff); + else + mCapsLight.turnOff(); + } else if (key == 2) { + if (on) + mFnLight.setColor(0x00ffffff); + else + mFnLight.turnOff(); + } + } + + @Override // Binder call public void wakeUp(long eventTime) { if (eventTime > SystemClock.uptimeMillis()) { throw new IllegalArgumentException("event time must not be in the future"); |
