summaryrefslogtreecommitdiff
path: root/core/java/android/view/KeyEvent.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-06-29 19:20:40 -0700
committerDianne Hackborn <hackbod@google.com>2010-06-30 10:49:40 -0700
commit3c80a4a044865bdf1289c7896baffa1c082d835c (patch)
tree557c89a685e672e44f90f55660da1f989d00a113 /core/java/android/view/KeyEvent.java
parent92dbad8ab0c8e242c4c3e52c339ed3296ae7901c (diff)
Implement default key handling for native code.
The native code now maintains a list of all keys that may use default handling. If the app finishes one of these keys without handling it, the key will be passed back off to Java for default treatment. Change-Id: I6a842a0d728eeafa4de7142fae573f8c11099e18
Diffstat (limited to 'core/java/android/view/KeyEvent.java')
-rwxr-xr-xcore/java/android/view/KeyEvent.java36
1 files changed, 9 insertions, 27 deletions
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index ae9746e96373..0bfb6d69c951 100755
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -676,33 +676,12 @@ public class KeyEvent implements Parcelable {
* TODO: should the dpad keys be here? arguably, because they also shouldn't be menu shortcuts
*/
public final boolean isSystem() {
- switch (mKeyCode) {
- case KEYCODE_MENU:
- case KEYCODE_SOFT_RIGHT:
- case KEYCODE_HOME:
- case KEYCODE_BACK:
- case KEYCODE_CALL:
- case KEYCODE_ENDCALL:
- case KEYCODE_VOLUME_UP:
- case KEYCODE_VOLUME_DOWN:
- case KEYCODE_MUTE:
- case KEYCODE_POWER:
- case KEYCODE_HEADSETHOOK:
- case KEYCODE_MEDIA_PLAY_PAUSE:
- case KEYCODE_MEDIA_STOP:
- case KEYCODE_MEDIA_NEXT:
- case KEYCODE_MEDIA_PREVIOUS:
- case KEYCODE_MEDIA_REWIND:
- case KEYCODE_MEDIA_FAST_FORWARD:
- case KEYCODE_CAMERA:
- case KEYCODE_FOCUS:
- case KEYCODE_SEARCH:
- case KEYCODE_PICTSYMBOLS:
- case KEYCODE_SWITCH_CHARSET:
- return true;
- default:
- return false;
- }
+ return native_isSystemKey(mKeyCode);
+ }
+
+ /** @hide */
+ public final boolean hasDefaultAction() {
+ return native_hasDefaultAction(mKeyCode);
}
@@ -1226,4 +1205,7 @@ public class KeyEvent implements Parcelable {
mDownTime = in.readLong();
mEventTime = in.readLong();
}
+
+ private native boolean native_isSystemKey(int keyCode);
+ private native boolean native_hasDefaultAction(int keyCode);
}