Jeff Brown 497a92cc5b Add keycodes and meta-key modifiers to support external keyboards.
Added new key maps for external keyboards.  These maps are intended to
be shared across devices by inheriting the "keyboards.mk" product
makefile as part of the device's product definition.

One of the trickier changes here was to unwind some code in
MetaKeyKeyListener that assumed that only the low 8 bits of the meta key
state were actually used.  The new code abandons bitshifts in favor
of simple conditionals that are probably easier to read anyways.
The special meta key state constants used by MetaKeyKeyListener
are now (@hide) defined in KeyEvent now so as to make it clearer that they
share the same code space even if those codes are not valid for KeyEvents.

The EventHub now takes care of detecting the appropriate key layout
map and key character map when the device is added and sets system
properties accordingly.  This avoids having duplicate code in
KeyCharacterMap to probe for the appropriate key character map
although the current probing mechanism has been preserved for legacy
reasons just in case.

Added support for tracking caps lock, num lock and scroll lock and
turning their corresponding LEDs on and off as needed.

The key character map format will need to be updated to correctly support
PC style external keyboard semantics related to modifier keys.
That will come in a later change so caps lock doesn't actually do
anything right now except turn the shiny LEDs on and off...

Added a list of symbolic key names to KeyEvent and improved the toString()
output for debug diagnosis.  Having this list in a central place in the
framework also allows us to remove it from Monkey so there is one less
thing to maintain when we add new keycodes.

Bug: 2912307
Change-Id: If8c25e8d50a7c29bbf5d663c94284f5f86de5da4
2010-10-15 16:00:07 -07:00

101 lines
5.7 KiB
Plaintext

# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generic key character map for full alphabetic US English PC style external keyboards.
#
# This file is intentionally very generic and is intended to support a broad rang of keyboards.
# Do not edit the generic key character map to support a specific keyboard; instead, create
# a new key character map file with the required keyboard configuration.
#
[type=QWERTY]
# keycode display number base caps fn caps_fn
A 'A' '2' 'a' 'A' 'a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'~'
MINUS '-' '-' '-' '_' '-' '_'
EQUALS '=' '=' '=' '+' '=' '+'
LEFT_BRACKET '[' '[' '[' '{' '[' '{'
RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
BACKSLASH '\' '\' '\' '|' '\' '|'
SEMICOLON ';' ';' ';' ':' ';' ':'
APOSTROPHE ''' ''' ''' '"' ''' '"'
NUMPAD_0 '0' '0' '0' '0' '0' '0'
NUMPAD_1 '1' '1' '1' '1' '1' '1'
NUMPAD_2 '2' '2' '2' '2' '2' '2'
NUMPAD_3 '3' '3' '3' '3' '3' '3'
NUMPAD_4 '4' '4' '4' '4' '4' '4'
NUMPAD_5 '5' '5' '5' '5' '5' '5'
NUMPAD_6 '6' '6' '6' '6' '6' '6'
NUMPAD_7 '7' '7' '7' '7' '7' '7'
NUMPAD_8 '8' '8' '8' '8' '8' '8'
NUMPAD_9 '9' '9' '9' '9' '9' '9'
NUMPAD_LEFT_PAREN '(' '(' '(' '(' '(' '('
NUMPAD_RIGHT_PAREN ')' ')' ')' ')' ')' ')'
NUMPAD_DIVIDE '/' '/' '/' '/' '/' '/'
NUMPAD_MULTIPLY '*' '*' '*' '*' '*' '*'
NUMPAD_SUBTRACT '-' '-' '-' '-' '-' '-'
NUMPAD_ADD '+' '+' '+' '+' '+' '+'
NUMPAD_DOT '.' '.' '.' '.' '.' '.'
NUMPAD_COMMA ',' ',' ',' ',' ',' ','
NUMPAD_EQUALS '=' '=' '=' '=' '=' '='
NUMPAD_ENTER 0xa 0xa 0xa 0xa 0xa 0xa