diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-06-29 19:20:40 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-06-30 10:49:40 -0700 |
commit | 3c80a4a044865bdf1289c7896baffa1c082d835c (patch) | |
tree | 557c89a685e672e44f90f55660da1f989d00a113 /native/android/input.cpp | |
parent | 92dbad8ab0c8e242c4c3e52c339ed3296ae7901c (diff) | |
download | frameworks_base-3c80a4a044865bdf1289c7896baffa1c082d835c.zip frameworks_base-3c80a4a044865bdf1289c7896baffa1c082d835c.tar.gz frameworks_base-3c80a4a044865bdf1289c7896baffa1c082d835c.tar.bz2 |
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 'native/android/input.cpp')
-rw-r--r-- | native/android/input.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/native/android/input.cpp b/native/android/input.cpp index e0544a1..8498840 100644 --- a/native/android/input.cpp +++ b/native/android/input.cpp @@ -225,6 +225,15 @@ int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent) { void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled) { + if (!handled && ((InputEvent*)event)->getType() == INPUT_EVENT_TYPE_KEY + && ((KeyEvent*)event)->hasDefaultAction()) { + // The app didn't handle this, but it may have a default action + // associated with it. We need to hand this back to Java to be + // executed. + queue->doDefaultKey((KeyEvent*)event); + return; + } + int32_t res = queue->getConsumer().sendFinishedSignal(); if (res != android::OK) { LOGW("Failed to send finished signal on channel '%s'. status=%d", |