diff options
Diffstat (limited to 'include/ui')
-rw-r--r-- | include/ui/EventHub.h | 23 | ||||
-rw-r--r-- | include/ui/Input.h | 3 | ||||
-rw-r--r-- | include/ui/InputReader.h | 13 | ||||
-rwxr-xr-x | include/ui/KeycodeLabels.h | 56 |
4 files changed, 89 insertions, 6 deletions
diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h index d78e35f..1431964 100644 --- a/include/ui/EventHub.h +++ b/include/ui/EventHub.h @@ -187,6 +187,9 @@ public: virtual bool markSupportedKeyCodes(int32_t deviceId, size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags) const = 0; + virtual bool hasLed(int32_t deviceId, int32_t led) const = 0; + virtual void setLedState(int32_t deviceId, int32_t led, bool on) = 0; + virtual void dump(String8& dump) = 0; }; @@ -198,9 +201,9 @@ public: status_t errorCheck() const; virtual uint32_t getDeviceClasses(int32_t deviceId) const; - + virtual String8 getDeviceName(int32_t deviceId) const; - + virtual status_t getAbsoluteAxisInfo(int32_t deviceId, int axis, RawAbsoluteAxisInfo* outAxisInfo) const; @@ -218,6 +221,9 @@ public: virtual bool getEvent(RawEvent* outEvent); + virtual bool hasLed(int32_t deviceId, int32_t led) const; + virtual void setLedState(int32_t deviceId, int32_t led, bool on); + virtual void dump(String8& dump); protected: @@ -240,7 +246,10 @@ private: uint32_t classes; uint8_t* keyBitmask; KeyLayoutMap* layoutMap; - String8 keylayoutFilename; + String8 keyMapName; + bool defaultKeyMap; + String8 keyLayoutFilename; + String8 keyCharacterMapFilename; int fd; device_t* next; @@ -250,13 +259,19 @@ private: device_t* getDeviceLocked(int32_t deviceId) const; bool hasKeycodeLocked(device_t* device, int keycode) const; - + int32_t getScanCodeStateLocked(device_t* device, int32_t scanCode) const; int32_t getKeyCodeStateLocked(device_t* device, int32_t keyCode) const; int32_t getSwitchStateLocked(device_t* device, int32_t sw) const; bool markSupportedKeyCodesLocked(device_t* device, size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags) const; + void configureKeyMap(device_t* device); + bool probeKeyMap(device_t* device, const String8& keyMapName, bool defaultKeyMap); + void selectKeyMap(device_t* device, const String8& keyMapName, bool defaultKeyMap); + void setKeyboardProperties(device_t* device, bool firstKeyboard); + void clearKeyboardProperties(device_t* device, bool firstKeyboard); + // Protect all internal state. mutable Mutex mLock; diff --git a/include/ui/Input.h b/include/ui/Input.h index 8c6018b..1355bab 100644 --- a/include/ui/Input.h +++ b/include/ui/Input.h @@ -76,7 +76,7 @@ namespace android { */ enum { /* These flags originate in RawEvents and are generally set in the key map. - * See also labels for policy flags in KeycodeLabels.h. */ + * NOTE: If you edit these flags, also edit labels in KeycodeLabels.h. */ POLICY_FLAG_WAKE = 0x00000001, POLICY_FLAG_WAKE_DROPPED = 0x00000002, @@ -87,6 +87,7 @@ enum { POLICY_FLAG_MENU = 0x00000040, POLICY_FLAG_LAUNCHER = 0x00000080, POLICY_FLAG_VIRTUAL = 0x00000100, + POLICY_FLAG_FUNCTION = 0x00000200, POLICY_FLAG_RAW_MASK = 0x0000ffff, diff --git a/include/ui/InputReader.h b/include/ui/InputReader.h index c15e382..a1b59e6 100644 --- a/include/ui/InputReader.h +++ b/include/ui/InputReader.h @@ -419,9 +419,18 @@ private: Vector<KeyDown> keyDowns; // keys that are down int32_t metaState; nsecs_t downTime; // time of most recent key down + + struct LedState { + bool avail; // led is available + bool on; // we think the led is currently on + }; + LedState capsLockLedState; + LedState numLockLedState; + LedState scrollLockLedState; } mLocked; void initializeLocked(); + void initializeLedStateLocked(LockedState::LedState& ledState, int32_t led); bool isKeyboardOrGamepadKey(int32_t scanCode); @@ -429,6 +438,10 @@ private: uint32_t policyFlags); ssize_t findKeyDownLocked(int32_t scanCode); + + void updateLedStateLocked(bool reset); + void updateLedStateForModifierLocked(LockedState::LedState& ledState, int32_t led, + int32_t modifier, bool reset); }; diff --git a/include/ui/KeycodeLabels.h b/include/ui/KeycodeLabels.h index f71d9cd..ef2b6b3 100755 --- a/include/ui/KeycodeLabels.h +++ b/include/ui/KeycodeLabels.h @@ -135,6 +135,59 @@ static const KeycodeLabel KEYCODES[] = { { "BUTTON_START", 108 }, { "BUTTON_SELECT", 109 }, { "BUTTON_MODE", 110 }, + { "ESCAPE", 111 }, + { "FORWARD_DEL", 112 }, + { "CTRL_LEFT", 113 }, + { "CTRL_RIGHT", 114 }, + { "CAPS_LOCK", 115 }, + { "SCROLL_LOCK", 116 }, + { "META_LEFT", 117 }, + { "META_RIGHT", 118 }, + { "FUNCTION", 119 }, + { "SYSRQ", 120 }, + { "BREAK", 121 }, + { "MOVE_HOME", 122 }, + { "MOVE_END", 123 }, + { "INSERT", 124 }, + { "FORWARD", 125 }, + { "MEDIA_PLAY", 126 }, + { "MEDIA_PAUSE", 127 }, + { "MEDIA_CLOSE", 128 }, + { "MEDIA_EJECT", 129 }, + { "MEDIA_RECORD", 130 }, + { "F1", 131 }, + { "F2", 132 }, + { "F3", 133 }, + { "F4", 134 }, + { "F5", 135 }, + { "F6", 136 }, + { "F7", 137 }, + { "F8", 138 }, + { "F9", 139 }, + { "F10", 140 }, + { "F11", 141 }, + { "F12", 142 }, + { "NUM_LOCK", 143 }, + { "NUMPAD_0", 144 }, + { "NUMPAD_1", 145 }, + { "NUMPAD_2", 146 }, + { "NUMPAD_3", 147 }, + { "NUMPAD_4", 148 }, + { "NUMPAD_5", 149 }, + { "NUMPAD_6", 150 }, + { "NUMPAD_7", 151 }, + { "NUMPAD_8", 152 }, + { "NUMPAD_9", 153 }, + { "NUMPAD_DIVIDE", 154 }, + { "NUMPAD_MULTIPLY", 155 }, + { "NUMPAD_SUBTRACT", 156 }, + { "NUMPAD_ADD", 157 }, + { "NUMPAD_DOT", 158 }, + { "NUMPAD_COMMA", 159 }, + { "NUMPAD_ENTER", 160 }, + { "NUMPAD_EQUALS", 161 }, + { "NUMPAD_LEFT_PAREN", 162 }, + { "NUMPAD_RIGHT_PAREN", 163 }, // NOTE: If you add a new keycode here you must also add it to several other files. // Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list. @@ -142,7 +195,7 @@ static const KeycodeLabel KEYCODES[] = { { NULL, 0 } }; -// See also policy flags in Input.h. +// NOTE: If you edit these flags, also edit policy flags in Input.h. static const KeycodeLabel FLAGS[] = { { "WAKE", 0x00000001 }, { "WAKE_DROPPED", 0x00000002 }, @@ -153,6 +206,7 @@ static const KeycodeLabel FLAGS[] = { { "MENU", 0x00000040 }, { "LAUNCHER", 0x00000080 }, { "VIRTUAL", 0x00000100 }, + { "FUNCTION", 0x00000200 }, { NULL, 0 } }; |