Merge "Declare KEYCODE_SLEEP and KEYCODE_WAKEUP." into klp-modular-dev

This commit is contained in:
Jeff Brown
2014-03-07 22:15:08 +00:00
committed by Android (Google) Code Review
5 changed files with 33 additions and 5 deletions

View File

@@ -26903,6 +26903,7 @@ package android.view {
field public static final int KEYCODE_SHIFT_LEFT = 59; // 0x3b field public static final int KEYCODE_SHIFT_LEFT = 59; // 0x3b
field public static final int KEYCODE_SHIFT_RIGHT = 60; // 0x3c field public static final int KEYCODE_SHIFT_RIGHT = 60; // 0x3c
field public static final int KEYCODE_SLASH = 76; // 0x4c field public static final int KEYCODE_SLASH = 76; // 0x4c
field public static final int KEYCODE_SLEEP = 223; // 0xdf
field public static final int KEYCODE_SOFT_LEFT = 1; // 0x1 field public static final int KEYCODE_SOFT_LEFT = 1; // 0x1
field public static final int KEYCODE_SOFT_RIGHT = 2; // 0x2 field public static final int KEYCODE_SOFT_RIGHT = 2; // 0x2
field public static final int KEYCODE_SPACE = 62; // 0x3e field public static final int KEYCODE_SPACE = 62; // 0x3e
@@ -26924,6 +26925,7 @@ package android.view {
field public static final int KEYCODE_VOLUME_MUTE = 164; // 0xa4 field public static final int KEYCODE_VOLUME_MUTE = 164; // 0xa4
field public static final int KEYCODE_VOLUME_UP = 24; // 0x18 field public static final int KEYCODE_VOLUME_UP = 24; // 0x18
field public static final int KEYCODE_W = 51; // 0x33 field public static final int KEYCODE_W = 51; // 0x33
field public static final int KEYCODE_WAKEUP = 224; // 0xe0
field public static final int KEYCODE_WINDOW = 171; // 0xab field public static final int KEYCODE_WINDOW = 171; // 0xab
field public static final int KEYCODE_X = 52; // 0x34 field public static final int KEYCODE_X = 52; // 0x34
field public static final int KEYCODE_Y = 53; // 0x35 field public static final int KEYCODE_Y = 53; // 0x35

View File

@@ -629,11 +629,19 @@ public class KeyEvent extends InputEvent implements Parcelable {
/** Key code constant: Brightness Up key. /** Key code constant: Brightness Up key.
* Adjusts the screen brightness up. */ * Adjusts the screen brightness up. */
public static final int KEYCODE_BRIGHTNESS_UP = 221; public static final int KEYCODE_BRIGHTNESS_UP = 221;
/** Key code constant: Audio Track key /** Key code constant: Audio Track key.
* Switches the audio tracks. */ * Switches the audio tracks. */
public static final int KEYCODE_MEDIA_AUDIO_TRACK = 222; 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: // NOTE: If you add a new keycode here you must also add it to:
// isSystem() // isSystem()
@@ -878,6 +886,8 @@ public class KeyEvent extends InputEvent implements Parcelable {
names.append(KEYCODE_BRIGHTNESS_DOWN, "KEYCODE_BRIGHTNESS_DOWN"); names.append(KEYCODE_BRIGHTNESS_DOWN, "KEYCODE_BRIGHTNESS_DOWN");
names.append(KEYCODE_BRIGHTNESS_UP, "KEYCODE_BRIGHTNESS_UP"); names.append(KEYCODE_BRIGHTNESS_UP, "KEYCODE_BRIGHTNESS_UP");
names.append(KEYCODE_MEDIA_AUDIO_TRACK, "KEYCODE_MEDIA_AUDIO_TRACK"); 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. // Symbolic names of all metakeys in bit order from least significant to most significant.

View File

@@ -1571,6 +1571,8 @@
<enum name="KEYCODE_BRIGHTNESS_DOWN" value="220" /> <enum name="KEYCODE_BRIGHTNESS_DOWN" value="220" />
<enum name="KEYCODE_BRIGHTNESS_UP" value="221" /> <enum name="KEYCODE_BRIGHTNESS_UP" value="221" />
<enum name="KEYCODE_MEDIA_AUDIO_TRACK" value="222" /> <enum name="KEYCODE_MEDIA_AUDIO_TRACK" value="222" />
<enum name="KEYCODE_MEDIA_SLEEP" value="223" />
<enum name="KEYCODE_MEDIA_WAKEUP" value="224" />
</attr> </attr>
<!-- ***************************************************************** --> <!-- ***************************************************************** -->

View File

@@ -161,8 +161,8 @@ key 128 MEDIA_STOP
key 139 MENU WAKE_DROPPED key 139 MENU WAKE_DROPPED
key 140 CALCULATOR key 140 CALCULATOR
# key 141 "KEY_SETUP" # key 141 "KEY_SETUP"
key 142 POWER WAKE key 142 SLEEP WAKE
key 143 POWER WAKE key 143 WAKEUP WAKE
# key 144 "KEY_FILE" # key 144 "KEY_FILE"
# key 145 "KEY_SENDFILE" # key 145 "KEY_SENDFILE"
# key 146 "KEY_DELETEFILE" # key 146 "KEY_DELETEFILE"

View File

@@ -3816,7 +3816,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mKeyguardDelegate.isShowingAndNotHidden() : mKeyguardDelegate.isShowingAndNotHidden() :
mKeyguardDelegate.isShowing())); mKeyguardDelegate.isShowing()));
if (keyCode == KeyEvent.KEYCODE_POWER) { if (keyCode == KeyEvent.KEYCODE_POWER
|| keyCode == KeyEvent.KEYCODE_SLEEP
|| keyCode == KeyEvent.KEYCODE_WAKEUP) {
policyFlags |= WindowManagerPolicy.FLAG_WAKE; policyFlags |= WindowManagerPolicy.FLAG_WAKE;
} }
@@ -4013,6 +4015,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
break; break;
} }
case KeyEvent.KEYCODE_SLEEP: {
result &= ~ACTION_PASS_TO_USER;
mPowerManager.goToSleep(event.getEventTime());
isWakeKey = false;
break;
}
case KeyEvent.KEYCODE_WAKEUP: {
result &= ~ACTION_PASS_TO_USER;
break;
}
case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PLAY:
case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_PAUSE:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: