summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-04-11 18:27:33 -0700
committerJeff Brown <jeffbrown@google.com>2012-04-11 20:28:09 -0700
commit49ccac530b5a798e3c4a79b66b51b8546a0deed1 (patch)
tree0b25fa1110effb7e8aa46905928b0b159daa96ab /include
parentdb13a6bf788cc48af86c8acf6f74b416dfd84199 (diff)
downloadframeworks_base-49ccac530b5a798e3c4a79b66b51b8546a0deed1.zip
frameworks_base-49ccac530b5a798e3c4a79b66b51b8546a0deed1.tar.gz
frameworks_base-49ccac530b5a798e3c4a79b66b51b8546a0deed1.tar.bz2
Refactor key code mapping.
Added handling for EV_MSC / MSC_SCAN which typically reports the HID usage associated with a key. This will enable key maps to map keys with HID usages that Linux does not natively recognize. Removed keyCode and flags fields from EventHub RawEvent since they don't necessarily make sense in isolation now that we pay attention to HID usage codes too. Removed the fallback code for mapping keys and axes. In practice, an input device should be self-sufficient. We should not ever need to look at the built-in keyboard's key map. In fact, there usually isn't a built-in keyboard anyhow. This code was originally working around a problem where we weren't loading the key map for touch screens with virtual keys, which has long since been fixed. Change-Id: I0a319bdec44be9514f795526347397e94d53a127
Diffstat (limited to 'include')
-rw-r--r--include/androidfw/KeyLayoutMap.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/androidfw/KeyLayoutMap.h b/include/androidfw/KeyLayoutMap.h
index 5408680..e7f22a2 100644
--- a/include/androidfw/KeyLayoutMap.h
+++ b/include/androidfw/KeyLayoutMap.h
@@ -64,7 +64,8 @@ class KeyLayoutMap : public RefBase {
public:
static status_t load(const String8& filename, sp<KeyLayoutMap>* outMap);
- status_t mapKey(int32_t scanCode, int32_t* keyCode, uint32_t* flags) const;
+ status_t mapKey(int32_t scanCode, int32_t usageCode,
+ int32_t* outKeyCode, uint32_t* outFlags) const;
status_t findScanCodesForKey(int32_t keyCode, Vector<int32_t>* outScanCodes) const;
status_t mapAxis(int32_t scanCode, AxisInfo* outAxisInfo) const;
@@ -78,11 +79,14 @@ private:
uint32_t flags;
};
- KeyedVector<int32_t, Key> mKeys;
+ KeyedVector<int32_t, Key> mKeysByScanCode;
+ KeyedVector<int32_t, Key> mKeysByUsageCode;
KeyedVector<int32_t, AxisInfo> mAxes;
KeyLayoutMap();
+ const Key* getKey(int32_t scanCode, int32_t usageCode) const;
+
class Parser {
KeyLayoutMap* mMap;
Tokenizer* mTokenizer;