diff options
author | Jeff Brown <jeffbrown@google.com> | 2014-03-07 13:58:47 -0800 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2014-03-07 14:02:55 -0800 |
commit | 6212a49a9475768316a999596ffc4dd0f4ce96e5 (patch) | |
tree | c603b01b0acd899910030cf9b7bf9f2097928ec6 /core/java/android/view | |
parent | 16ed831eb391e1d08050c52579f316ed5505c1e8 (diff) | |
download | frameworks_base-6212a49a9475768316a999596ffc4dd0f4ce96e5.zip frameworks_base-6212a49a9475768316a999596ffc4dd0f4ce96e5.tar.gz frameworks_base-6212a49a9475768316a999596ffc4dd0f4ce96e5.tar.bz2 |
Declare KEYCODE_SLEEP and KEYCODE_WAKEUP.
These new keys behave in similarly to KEYCODE_POWER but do not
simply toggle between awake and asleep states.
Sleep puts the device to sleep if it is awake.
Wakeup wakes up the device if it is asleep.
Bug: 12938999
Change-Id: I260fb918cc858882fe06fa880910df5763a76c5d
Diffstat (limited to 'core/java/android/view')
-rw-r--r-- | core/java/android/view/KeyEvent.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index 5a5fc10..6a6c127 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -629,11 +629,19 @@ public class KeyEvent extends InputEvent implements Parcelable { /** Key code constant: Brightness Up key. * Adjusts the screen brightness up. */ public static final int KEYCODE_BRIGHTNESS_UP = 221; - /** Key code constant: Audio Track key + /** Key code constant: Audio Track key. * Switches the audio tracks. */ public static final int KEYCODE_MEDIA_AUDIO_TRACK = 222; + /** Key code constant: Sleep key. + * Puts the device to sleep. Behaves somewhat like {@link #KEYCODE_POWER} but it + * has no effect if the device is already asleep. */ + public static final int KEYCODE_SLEEP = 223; + /** Key code constant: Wakeup key. + * Wakes up the device. Behaves somewhat like {@link #KEYCODE_POWER} but it + * has no effect if the device is already awake. */ + public static final int KEYCODE_WAKEUP = 224; - private static final int LAST_KEYCODE = KEYCODE_MEDIA_AUDIO_TRACK; + private static final int LAST_KEYCODE = KEYCODE_WAKEUP; // NOTE: If you add a new keycode here you must also add it to: // isSystem() @@ -878,6 +886,8 @@ public class KeyEvent extends InputEvent implements Parcelable { names.append(KEYCODE_BRIGHTNESS_DOWN, "KEYCODE_BRIGHTNESS_DOWN"); names.append(KEYCODE_BRIGHTNESS_UP, "KEYCODE_BRIGHTNESS_UP"); names.append(KEYCODE_MEDIA_AUDIO_TRACK, "KEYCODE_MEDIA_AUDIO_TRACK"); + names.append(KEYCODE_SLEEP, "KEYCODE_SLEEP"); + names.append(KEYCODE_WAKEUP, "KEYCODE_WAKEUP"); }; // Symbolic names of all metakeys in bit order from least significant to most significant. |