summaryrefslogtreecommitdiffstats
path: root/services/input
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-12-07 16:36:01 -0800
committerJeff Brown <jeffbrown@google.com>2011-12-07 21:37:16 -0800
commit68b909d8acd92343fa0b1dff2f77fcd9d9991f9f (patch)
tree73df34f562dafe3807615c773530dedce3d83ae0 /services/input
parenteb3e4b98a45722d5d1ea73e45d86c119d678bb05 (diff)
downloadframeworks_base-68b909d8acd92343fa0b1dff2f77fcd9d9991f9f.zip
frameworks_base-68b909d8acd92343fa0b1dff2f77fcd9d9991f9f.tar.gz
frameworks_base-68b909d8acd92343fa0b1dff2f77fcd9d9991f9f.tar.bz2
Fix system hotkey handling.
Fixed a problem where the key up for the ALT or META key was not delivered to the task switcher dialog because it was deemed to be inconsistent with the window's observed state. Consequently the dialog would not be dismissed when the key was released. Moved global hotkey handling for META+* shortcuts and ALT/META-TAB into the window manager policy's interceptKeyBeforeDispatching method. This change prevents applications from hijacking these keys. The original idea was that these shortcuts would be handled only if the application did not handle them itself. That way certain applications, such as remote desktop tools, could deliberately override some of these less important system shortcuts. Unfortunately, that does make the behavior inconsistent across applications. What's more, bugs in the onKeyDown handler of applications can cause the shortcuts to not work at all, for no good reason. Perhaps we can add an opt-in feature later to enable specific applications to repurpose these keys when it makes sense. Bug: 5720358 Change-Id: I22bf17606d12dbea6549c60d20763e6608576cf7
Diffstat (limited to 'services/input')
-rw-r--r--services/input/InputDispatcher.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 04b4855..40268b0 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -4320,12 +4320,23 @@ bool InputDispatcher::InputState::trackKey(const KeyEntry* entry,
mKeyMementos.removeAt(index);
return true;
}
+ /* FIXME: We can't just drop the key up event because that prevents creating
+ * popup windows that are automatically shown when a key is held and then
+ * dismissed when the key is released. The problem is that the popup will
+ * not have received the original key down, so the key up will be considered
+ * to be inconsistent with its observed state. We could perhaps handle this
+ * by synthesizing a key down but that will cause other problems.
+ *
+ * So for now, allow inconsistent key up events to be dispatched.
+ *
#if DEBUG_OUTBOUND_EVENT_DETAILS
LOGD("Dropping inconsistent key up event: deviceId=%d, source=%08x, "
"keyCode=%d, scanCode=%d",
entry->deviceId, entry->source, entry->keyCode, entry->scanCode);
#endif
return false;
+ */
+ return true;
}
case AKEY_EVENT_ACTION_DOWN: {