aboutsummaryrefslogtreecommitdiff
path: root/en/devices/input
diff options
context:
space:
mode:
Diffstat (limited to 'en/devices/input')
-rw-r--r--en/devices/input/diagnostics.html21
-rw-r--r--en/devices/input/getevent.html31
-rw-r--r--en/devices/input/input-device-configuration-files.html17
-rw-r--r--en/devices/input/key-character-map-files.html47
-rw-r--r--en/devices/input/key-layout-files.html59
-rw-r--r--en/devices/input/keyboard-devices.html5
-rw-r--r--en/devices/input/touch-devices.html57
-rw-r--r--en/devices/input/validate-keymaps.html39
8 files changed, 169 insertions, 107 deletions
diff --git a/en/devices/input/diagnostics.html b/en/devices/input/diagnostics.html
index bd5036df..92780018 100644
--- a/en/devices/input/diagnostics.html
+++ b/en/devices/input/diagnostics.html
@@ -29,8 +29,8 @@ processing of input events.</p>
<h2 id="input">Input</h2>
<p>To dump the input system’s state, run the following command:</p>
-<pre>
-$ adb shell dumpsys input
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys input
</pre>
<h2 id="output">Output</h2>
@@ -46,7 +46,7 @@ but consists of three sections:</p>
<h3 id="event_hub_state">Event Hub State</h3>
-<pre><code>
+<pre class="devsite-click-to-copy">
INPUT MANAGER (dumpsys input)
Event Hub State:
@@ -171,7 +171,7 @@ the touch screen.</p>
<p>As an example, this is what a special function keypad looks like:</p>
-<pre>
+<pre class="devsite-click-to-copy">
Input Reader State
...
Device 3: tuna-gpio-keypad
@@ -192,7 +192,7 @@ Input Reader State
<p>Here is a touch screen. Notice all of the information about the resolution of
the device and the calibration parameters that were used.</p>
-<pre>
+<pre class="devsite-click-to-copy">
Input Reader State
...
Device 6: Melfas MMSxxx Touchscreen
@@ -264,7 +264,8 @@ Input Reader State
<p>Here is an external keyboard / mouse combo HID device. (This device doesn't actually
have a mouse but its HID descriptor says it does.)</p>
-<pre><code> Device 7: Motorola Bluetooth Wireless Keyboard
+<pre class="devsite-click-to-copy">
+ Device 7: Motorola Bluetooth Wireless Keyboard
IsExternal: true
Sources: 0x00002103
KeyboardType: 2
@@ -302,7 +303,8 @@ have a mouse but its HID descriptor says it does.)</p>
</code></pre>
<p>Here is a joystick. Notice how all of the axes have been scaled to a normalized
range. The axis mapping can be configured using key layout files.</p>
-<pre><code>Device 18: Logitech Logitech Cordless RumblePad 2
+<pre class="devsite-click-to-copy">
+Device 18: Logitech Logitech Cordless RumblePad 2
IsExternal: true
Sources: 0x01000511
KeyboardType: 1
@@ -345,7 +347,8 @@ range. The axis mapping can be configured using key layout files.</p>
</code></pre>
<p>At the end of the input reader dump there is some information about global configuration
parameters such as the mouse pointer speed.</p>
-<pre><code> Configuration:
+<pre class="devsite-click-to-copy">
+ Configuration:
ExcludedDeviceNames: []
VirtualKeyQuietTime: 0.0ms
PointerVelocityControlParameters: scale=1.000, lowThreshold=500.000, highThreshold=3000.000, acceleration=3.000
@@ -378,7 +381,7 @@ parameters such as the mouse pointer speed.</p>
<p>The <code>InputDispatcher</code> is responsible for sending input events to applications.
Its state dump shows information about which window is being touched, the
state of the input queue, whether an ANR is in progress, and so on.</p>
-<pre>
+<pre class="devsite-click-to-copy">
Input Dispatcher State:
DispatchEnabled: 1
DispatchFrozen: 0
diff --git a/en/devices/input/getevent.html b/en/devices/input/getevent.html
index c6f2c369..69746bcd 100644
--- a/en/devices/input/getevent.html
+++ b/en/devices/input/getevent.html
@@ -30,12 +30,15 @@ expected set of capabilities for each input device and are generating the
desired stream of input events.</p>
<h2 id="showing-device-capabilities">Showing device capabilities</h2>
-<p>Use the <code>-p</code> option to see all of the keys and axes a device
-reports. The following example lists the Linux key codes and other events a
-particular keyboard says it supports.</p>
+<p>Use the <code>-p</code> option with the <code>adb</code> command to see all of the keys and axes a device
+reports.</p>
+
+<pre class="devsite-terminal devsite-click-to-copy">adb shell su -- getevent -p</pre>
-<pre><code>$ adb shell su -- getevent -p
+<p>The following example lists the Linux key codes and other events a
+particular keyboard says it supports.</p>
+<pre>
name: "Motorola Bluetooth Wireless Keyboard"
events:
KEY (0001): 0001 0002 0003 0004 0005 0006 0007 0008
@@ -69,15 +72,17 @@ particular keyboard says it supports.</p>
LED (0011): 0000 0001 0002 0003 0004
input props:
&lt;none&gt;
-</code></pre>
+</pre>
<p>Use the <code>-i</code> option to get more information, including HID mapping
tables and debugging information.</p>
-<p>Use the <code>-l</code> option to display textual labels for all event codes.
-Example:</p>
-<pre><code>$ adb shell su -- getevent -lp /dev/input/event1
-
+<p>Use the <code>-l</code> option to display textual labels for all event codes.</p>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell su -- getevent -lp /dev/input/event1
+</pre>
+<p>Example:</p>
+<pre>
name: "Melfas MMSxxx Touchscreen"
events:
ABS (0003): ABS_MT_SLOT : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
@@ -95,8 +100,12 @@ touchscreen using the Linux multi-touch input protocol "B". The <code>-l</code>
option displays textual labels and the <code>-t</code> option displays
timestamps.</p>
-<pre><code>$ adb shell su -- getevent -lt /dev/input/event1
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell su -- getevent -lt /dev/input/event1
+</pre>
+<p>Example:</p>
+<pre>
[ 78826.389007] EV_ABS ABS_MT_TRACKING_ID 0000001f
[ 78826.389038] EV_ABS ABS_MT_PRESSURE 000000ab
[ 78826.389038] EV_ABS ABS_MT_POSITION_X 000000ab
@@ -112,7 +121,7 @@ timestamps.</p>
[ 78826.468719] EV_ABS ABS_MT_SLOT 00000001
[ 78826.468719] EV_ABS ABS_MT_TRACKING_ID ffffffff
[ 78826.468719] EV_SYN SYN_REPORT 00000000
-</code></pre>
+</pre>
<p class="note"><strong>Note:</strong> <code>getevent</code> timestamps use
the format $SECONDS.$MICROSECONDS in the CLOCK_MONOTONIC timebase. For details,
refer to getevent.c.</p>
diff --git a/en/devices/input/input-device-configuration-files.html b/en/devices/input/input-device-configuration-files.html
index 3e0f6da9..20402dac 100644
--- a/en/devices/input/input-device-configuration-files.html
+++ b/en/devices/input/input-device-configuration-files.html
@@ -68,8 +68,9 @@ assignments and comments.</p>
<h3 id="properties">Properties</h3>
<p>Property assignments each consist of a property name, an <code>=</code>, a property value,
and a new line. Like this:</p>
-<pre><code>property = value
-</code></pre>
+<pre class="devsite-click-to-copy">
+property = value
+</pre>
<p>Property names are non-empty literal text identifiers. They must not contain
whitespace. Each components of the input system defines a set of properties
that are used to configure its function.</p>
@@ -78,11 +79,13 @@ They must not contain whitespace or the reserved characters <code>\</code> or <c
<p>Property names and values are case-sensitive.</p>
<h3 id="comments">Comments</h3>
<p>Comment lines begin with '#' and continue to the end of the line. Like this:</p>
-<pre><code># A comment!
-</code></pre>
+<pre class="devsite-click-to-copy">
+# A comment!
+</pre>
<p>Blank lines are ignored.</p>
<h3 id="example">Example</h3>
-<pre><code># This is an example of an input device configuration file.
+<pre class="devsite-click-to-copy">
+# This is an example of an input device configuration file.
# It might be used to describe the characteristics of a built-in touch screen.
# This is an internal device, not an external peripheral attached to the USB
@@ -96,9 +99,9 @@ touch.orientationAware = 1
# Additional calibration properties...
# etc...
-</code></pre>
+</pre>
<h2 id="common-properties">Common Properties</h2>
-<p>The following properties are common to all input device classes.</p>
+<p>The following property is common to all input device classes.</p>
<p>Refer to the documentation of each input device class for information about the
special properties used by each class.</p>
<h4 id="deviceinternal"><code>device.internal</code></h4>
diff --git a/en/devices/input/key-character-map-files.html b/en/devices/input/key-character-map-files.html
index 68e370e1..803610e3 100644
--- a/en/devices/input/key-character-map-files.html
+++ b/en/devices/input/key-character-map-files.html
@@ -50,7 +50,7 @@ id or by input device name.</p>
<li><code>/data/system/devices/keychars/Virtual.kcm</code></li>
</ul>
<p>When constructing a file path that contains the device name, all characters
-in the device name other than '0'-'9', 'a'-'z', 'A'-'Z', '-' or '<em>' are replaced by '</em>'.</p>
+in the device name other than '0'-'9', 'a'-'z', 'A'-'Z', '-' or '_' are replaced by '_'.</p>
<h2 id="generic-key-character-map-file">Generic Key Character Map File</h2>
<p>The system provides a special built-in key character map file called <code>Generic.kcm</code>.
This key character map is intended to support a variety of standard external
@@ -76,8 +76,9 @@ declaration and a set of key declarations.</p>
<p>A keyboard type declaration describes the overall behavior of the keyboard.
A character map file must contain a keyboard type declaration. For clarity,
it is often placed at the top of the file.</p>
-<pre><code>type FULL
-</code></pre>
+<pre class="devsite-click-to-copy">
+type FULL
+</pre>
<p>The following keyboard types are recognized:</p>
<ul>
<li>
@@ -120,13 +121,14 @@ HOME and POWER that are not actually used for typing.</p>
<h3 id="key-declarations">Key Declarations</h3>
<p>Key declarations each consist of the keyword <code>key</code> followed by an Android key code
name, an open curly brace, a set of properties and behaviors and a close curly brace.</p>
-<pre><code>key A {
+<pre class="devsite-click-to-copy">
+key A {
label: 'A'
base: 'a'
shift, capslock: 'A'
ctrl, alt, meta: none
}
-</code></pre>
+</pre>
<h4 id="properties">Properties</h4>
<p>Each key property establishes a mapping from a key to a behavior. To make the
key character map files more compact, several properties can be mapped to the
@@ -254,8 +256,9 @@ key followed by the letter 'a', the result is '&agrave;'.</p>
<p>Refer to <code>KeyCharacterMap.getDeadChar</code> for more information about dead key handling.</p>
<h3 id="comments">Comments</h3>
<p>Comment lines begin with '#' and continue to the end of the line. Like this:</p>
-<pre><code># A comment!
-</code></pre>
+<pre class="devsite-click-to-copy">
+# A comment!
+</pre>
<p>Blank lines are ignored.</p>
<h3 id="how-key-combinations-are-mapped-to-behaviors">How Key Combinations are Mapped to Behaviors</h3>
<p>When the user presses a key, the system looks up the behavior associated with
@@ -263,13 +266,14 @@ the combination of that key press and the currently pressed modifiers.</p>
<h4 id="shift-a">SHIFT + A</h4>
<p>Suppose the user pressed A and SHIFT together. The system first locates
the set of properties and behaviors associated with <code>KEYCODE_A</code>.</p>
-<pre><code>key A {
+<pre class="devsite-click-to-copy">
+key A {
label: 'A'
base: 'a'
shift, capslock: 'A'
ctrl, alt, meta: none
}
-</code></pre>
+</pre>
<p>The system scans the properties from first to last and left to right, ignoring
the <code>label</code> and <code>number</code> properties, which are special.</p>
<p>The first property encountered is <code>base</code>. The <code>base</code> property always applies to
@@ -295,12 +299,13 @@ property appears after <code>base</code> so its behavior overrides the <code>bas
<p>So the resulting behavior for the key combination CONTROL + A is <code>none</code>.</p>
<h4 id="escape">ESCAPE</h4>
<p>Now suppose the user pressed ESCAPE.</p>
-<pre><code>key ESCAPE {
+<pre class="devsite-click-to-copy">
+key ESCAPE {
base: fallback BACK
alt, meta: fallback HOME
ctrl: fallback MENU
}
-</code></pre>
+</pre>
<p>This time the system obtains the behavior <code>fallback BACK</code>, a fallback behavior.
Because no character literal appears, no character will be typed.</p>
<p>When processing the key, the system will first deliver <code>KEYCODE_ESCAPE</code> to the
@@ -317,19 +322,21 @@ the NUM LOCK key is locked.</p>
when NUM LOCK is pressed. When NUM LOCK is not pressed, the key is delivered
to the application as usual, and if it is not handled, then the fallback
key <code>KEYCODE_INSERT</code> is delivered instead.</p>
-<pre><code>key NUMPAD_0 {
+<pre class="devsite-click-to-copy">
+key NUMPAD_0 {
label, number: '0'
base: fallback INSERT
numlock: '0'
ctrl, alt, meta: none
}
-</code></pre>
+</pre>
<p>As we can see, fallback key declarations greatly improve compatibility
with older applications that do not recognize or directly support all of the keys
that are present on a full PC style keyboard.</p>
<h3 id="examples">Examples</h3>
<h4 id="full-keyboard">Full Keyboard</h4>
-<pre><code># This is an example of part of a key character map file for a full keyboard
+<pre class="devsite-click-to-copy">
+# This is an example of part of a key character map file for a full keyboard
# include a few fallback behaviors for special keys that few applications
# handle themselves.
@@ -357,9 +364,10 @@ key NUMPAD_9 {
numlock: '9'
ctrl, alt, meta: none
}
-</code></pre>
+</pre>
<h4 id="alphanumeric-keyboard">Alphanumeric Keyboard</h4>
-<pre><code># This is an example of part of a key character map file for an alphanumeric
+<pre class="devsite-click-to-copy">
+# This is an example of part of a key character map file for an alphanumeric
# thumb keyboard. Some keys are combined, such as `A` and `2`. Here we
# specify `number` labels to tell the system what to do when the user is
# typing a number into a dial pad.
@@ -386,9 +394,10 @@ key SPACE {
alt: '\uef01'
shift+alt: '\uef01'
}
-</code></pre>
+</pre>
<h4 id="game-pad">Game Pad</h4>
-<pre><code># This is an example of part of a key character map file for a game pad.
+<pre class="devsite-click-to-copy">
+# This is an example of part of a key character map file for a game pad.
# It defines fallback actions that enable the user to navigate the user interface
# by pressing buttons.
@@ -409,7 +418,7 @@ key BUTTON_START {
key BUTTON_SELECT {
base: fallback MENU
}
-</code></pre>
+</pre>
<h2 id="compatibility-note">Compatibility Note</h2>
<p>Prior to Android Honeycomb 3.0, the Android key character map was specified
using a very different syntax and was compiled into a binary file format
diff --git a/en/devices/input/key-layout-files.html b/en/devices/input/key-layout-files.html
index b9ee2be9..22faf84e 100644
--- a/en/devices/input/key-layout-files.html
+++ b/en/devices/input/key-layout-files.html
@@ -70,11 +70,12 @@ HID usage and Android key code name. The HID usage is represented as a 32-bit
integer, where the high 16-bits represent the HID usage page and the low 16-bits
represent the HID usage ID. Either declaration can be followed by an optional
set of whitespace-delimited policy flags.</p>
-<pre><code>key 1 ESCAPE
+<pre class="devsite-click-to-copy">
+key 1 ESCAPE
key 114 VOLUME_DOWN
key 16 Q VIRTUAL
key usage 0x0c006F BRIGHTNESS_UP
-</code></pre>
+</pre>
<p>The following policy flags are recognized:</p>
<ul>
<li><code>FUNCTION</code>: The key should be interpreted as if the FUNCTION key
@@ -95,7 +96,9 @@ including at least one Android axis code name.</p>
<p>A basic axis simply maps a Linux axis code to an Android axis code name. The
following declaration maps <code>ABS_X</code> (indicated by <code>0x00</code>)
to <code>AXIS_X</code> (indicated by <code>X</code>).</p>
-<pre><code>axis 0x00 X</code></pre>
+<pre class="devsite-click-to-copy">
+axis 0x00 X
+</pre>
<p>In the above example, if the value of <code>ABS_X</code> is <code>5</code>
then <code>AXIS_X</code> is set to <code>5</code>.</p>
@@ -108,7 +111,8 @@ device encodes two different mutually exclusive logical axes.</p>
(indicated by <code>0x01</code>) to <code>AXIS_GAS</code> when less than
<code>0x7f</code> or to <code>AXIS_BRAKE</code> when greater than
<code>0x7f</code>.</p>
-<pre><code>axis 0x01 split 0x7f GAS BRAKE</code></pre>
+<pre class="devsite-click-to-copy">
+axis 0x01 split 0x7f GAS BRAKE</pre>
<p>In the above example, if the value of <code>ABS_Y</code> is <code>0x7d</code>
then <code>AXIS_GAS</code> is set to <code>2</code> (<code>0x7f - 0x7d</code>)
and <code>AXIS_BRAKE</code> is set to <code>0</code>. Conversely, if the value
@@ -123,7 +127,9 @@ the split value of <code>0x7f</code> then both <code>AXIS_GAS</code> and
declaration maps <code>ABS_RZ</code> (indicated by <code>0x05</code>) to
<code>AXIS_BRAKE</code> (indicated by <code>BRAKE</code>), and inverts the
output by negating it.</p>
-<pre><code>axis 0x05 invert BRAKE</code></pre>
+<pre class="devsite-click-to-copy">
+axis 0x05 invert BRAKE
+</pre>
<p>In the above example, if the value of <code>ABS_RZ</code> is <code>2</code>
then <code>AXIS_BRAKE</code> is set to <code>-2</code>.</p>
@@ -136,19 +142,24 @@ the center flat position of joystick axes but not all of them do and some of
them provide incorrect values. To resolve this issue, an axis declaration may be
followed by a <code>flat</code> option that specifies the value of the center
flat position for the axis.</p>
-<pre><code>axis 0x03 Z flat 4096</code></pre>
+<pre class="devsite-click-to-copy">
+axis 0x03 Z flat 4096
+</pre>
<p>In the above example, the center flat position is set to <code>4096</code>.
</p>
<h3 id="comments">Comments</h3>
<p>Comment lines begin with # and continue to the end of the line:</p>
-<pre><code># A comment!</code></pre>
+<pre class="devsite-click-to-copy">
+# A comment!
+</pre>
<p>Blank lines are ignored.</p>
<h3 id="examples">Examples</h3>
<h4 id="keyboard">Keyboard</h4>
-<pre><code># This is an example of a key layout file for a keyboard.
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for a keyboard.
key 1 ESCAPE
key 2 1
@@ -166,29 +177,32 @@ key 13 EQUALS
key 14 DEL
# etc...
-</code></pre>
+</pre>
<h4 id="system-controls">System Controls</h4>
-<pre><code># This is an example of a key layout file for basic system controls,
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for basic system controls,
# such as volume and power keys which are typically implemented as GPIO pins
# the device decodes into key presses.
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 POWER
-</code></pre>
+</pre>
<h4 id="capacitive-buttons">Capacitive Buttons</h4>
-<pre><code># This is an example of a key layout file for a touch device with capacitive buttons.
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for a touch device with capacitive buttons.
key 139 MENU VIRTUAL
key 102 HOME VIRTUAL
key 158 BACK VIRTUAL
key 217 SEARCH VIRTUAL
-</code></pre>
+</pre>
<h4 id="headset-jack-media-controls">Headset Jack Media Controls</h4>
-<pre><code># This is an example of a key layout file for headset mounted media controls.
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for headset mounted media controls.
# A typical headset jack interface might have special control wires or detect known
# resistive loads as corresponding to media functions or volume controls.
# This file assumes that the driver decodes these signals and reports media
@@ -197,10 +211,11 @@ key 217 SEARCH VIRTUAL
key 163 MEDIA_NEXT
key 165 MEDIA_PREVIOUS
key 226 HEADSETHOOK
-</code></pre>
+</pre>
<h4 id="joystick">Joystick</h4>
-<pre><code># This is an example of a key layout file for a joystick.
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for a joystick.
# These are the buttons that the joystick supports, represented as keys.
key 304 BUTTON_A
@@ -231,7 +246,7 @@ axis 0x05 RTRIGGER
# Hat.
axis 0x10 HAT_X
axis 0x11 HAT_Y
-</code></pre>
+</pre>
<h2 id="virtual-soft-keys">Virtual Soft Keys</h2>
<p>The input system provides special features for implementing virtual soft keys
@@ -268,22 +283,24 @@ time after the most recent touch on the touch screen (this delay is called the
<ol>
<li>Provide a key layout file for the touch screen or capacitive button
input device with the <code>VIRTUAL</code> flag set for each key.
-<pre><code>key 139 MENU VIRTUAL
+<pre class="devsite-click-to-copy">
+key 139 MENU VIRTUAL
key 102 HOME VIRTUAL
key 158 BACK VIRTUAL
key 217 SEARCH VIRTUAL
-</code></pre>
+</pre>
</li>
<li>Set the value of the virtual key quiet time in a resource overlay for the
framework <code>config.xml</code> resource.
-<pre><code>&lt;!-- Specifies the amount of time to disable virtual keys after the screen
+<pre class="devsite-click-to-copy">
+&lt;!-- Specifies the amount of time to disable virtual keys after the screen
is touched to filter out accidental virtual key presses due to swiping gestures
or taps near the edge of the display. May be 0 to disable the feature.
It is recommended that this value be no more than 250 ms.
This feature should be disabled for most devices. --&gt;
&lt;integer name="config_virtualKeyQuietTimeMillis"&gt;250&lt;/integer&gt;
-</code></pre>
+</pre>
</li>
</ol>
diff --git a/en/devices/input/keyboard-devices.html b/en/devices/input/keyboard-devices.html
index 94ff3178..34f3575b 100644
--- a/en/devices/input/keyboard-devices.html
+++ b/en/devices/input/keyboard-devices.html
@@ -229,7 +229,8 @@ type of <code>SPECIAL_FUNCTION</code>) will never be registered as the built-in
regardless of the setting of this property. This is because a special-function
keyboard is by definition not intended to be used for general purpose typing.</p>
<h3 id="example-configurations">Example Configurations</h3>
-<pre><code># This is an example input device configuration file for a built-in
+<pre class="devsite-click-to-copy">
+# This is an example input device configuration file for a built-in
# keyboard that has a DPad.
# The keyboard is internal because it is part of the device.
@@ -245,7 +246,7 @@ keyboard.builtIn = 1
# DPad always means 'up' from the perspective of the user, even when the entire
# device has been rotated.
keyboard.orientationAware = 1
-</code></pre>
+</pre>
<h3 id="compatibility-notes">Compatibility Notes</h3>
<p>Prior to Honeycomb, the keyboard input mapper did not use any configuration properties.
All keyboards were assumed to be physically attached and orientation aware. The default
diff --git a/en/devices/input/touch-devices.html b/en/devices/input/touch-devices.html
index bc65c5c7..8cbcc66b 100644
--- a/en/devices/input/touch-devices.html
+++ b/en/devices/input/touch-devices.html
@@ -357,9 +357,10 @@ actually touching the screen or is merely in range and hovering.</p>
<p>For a touch screen, the system automatically interpolates the reported touch
positions in surface units to obtain touch positions in display pixels according
to the following calculation:</p>
-<pre><code>displayX = (x - minX) * displayWidth / (maxX - minX + 1)
+<pre class="devsite-click-to-copy">
+displayX = (x - minX) * displayWidth / (maxX - minX + 1)
displayY = (y - minY) * displayHeight / (maxY - minY + 1)
-</code></pre>
+</pre>
<p>A touch screen may report touches outside of the reported active area.</p>
<p>Touches that are initiated outside the active area are not delivered to applications
but may be used for virtual keys.</p>
@@ -713,7 +714,8 @@ is set, or <code>spots</code> otherwise.</p>
<h4 id="calculation">Calculation</h4>
<p>The calculation is straightforward: positional information from the touch driver is
linearly interpolated to the output coordinate system.</p>
-<pre><code>xScale = output.width / raw.width
+<pre class="devsite-click-to-copy">
+xScale = output.width / raw.width
yScale = output.height / raw.height
If not orientation aware or screen rotation is 0 degrees:
@@ -729,7 +731,7 @@ Else If rotation is 270 degrees:
output.x = (raw.y.max - raw.y) * yScale
output.y = (raw.x - raw.x.min) * xScale
End If
-</code></pre>
+</pre>
<h3 id="touchmajor-touchminor-toolmajor-toolminor-size-fields"><code>TouchMajor</code>, <code>TouchMinor</code>, <code>ToolMajor</code>, <code>ToolMinor</code>, <code>Size</code> Fields</h3>
<p>The <code>TouchMajor</code> and <code>TouchMinor</code> fields describe the approximate dimensions
of the contact area in output units (pixels).</p>
@@ -807,7 +809,8 @@ that represents their total area or width. This property should only be set to
<h4 id="calculation_1">Calculation</h4>
<p>The calculation of the <code>TouchMajor</code>, <code>TouchMinor</code>, <code>ToolMajor</code>, <code>ToolMinor</code>
and <code>Size</code> fields depends on the specified calibration parameters.</p>
-<pre><code>If raw.touchMajor and raw.toolMajor are available:
+<pre class="devsite-click-to-copy">
+If raw.touchMajor and raw.toolMajor are available:
touchMajor = raw.touchMajor
touchMinor = raw.touchMinor
toolMajor = raw.toolMajor
@@ -879,7 +882,7 @@ Else
End If
output.size = size
-</code></pre>
+</pre>
<h3 id="pressure-field"><code>Pressure</code> Field</h3>
<p>The <code>Pressure</code> field describes the approximate physical pressure applied to the
touch device as a normalized value between 0.0 (no touch) and 1.0 (full force).</p>
@@ -911,7 +914,7 @@ touch device as a normalized value between 0.0 (no touch) and 1.0 (full force).<
<p>The default value is <code>1.0 / raw.pressure.max</code>.</p>
<h4 id="calculation_2">Calculation</h4>
<p>The calculation of the <code>Pressure</code> field depends on the specified calibration parameters.</p>
-<pre><code>If touch.pressure.calibration == "physical" or "amplitude":
+<pre class="devsite-click-to-copy">If touch.pressure.calibration == "physical" or "amplitude":
output.pressure = raw.pressure * touch.pressure.scale
Else
If hovering:
@@ -920,7 +923,7 @@ Else
output.pressure = 1
End If
End If
-</code></pre>
+</pre>
<h3 id="orientation-and-tilt-fields"><code>Orientation</code> and <code>Tilt</code> Fields</h3>
<p>The <code>Orientation</code> field describes the orientation of the touch and tool as an
angular measurement. An orientation of <code>0</code> indicates that the major axis is
@@ -959,7 +962,8 @@ A tilt of <code>PI/2</code> indicates that the tool is flat on the surface.</p>
<h4 id="calculation_3">Calculation</h4>
<p>The calculation of the <code>Orientation</code> and <code>Tilt</code> fields depends on the specified
calibration parameters and available input.</p>
-<pre><code>If touch.tiltX and touch.tiltY are available:
+<pre class="devsite-click-to-copy">
+If touch.tiltX and touch.tiltY are available:
tiltXCenter = average(raw.tiltX.min, raw.tiltX.max)
tiltYCenter = average(raw.tiltY.min, raw.tiltY.max)
tiltXAngle = (raw.tiltX - tiltXCenter) * PI / 180
@@ -1005,7 +1009,7 @@ If orientation aware:
output.orientation = output.orientation + PI / 2
End If
End If
-</code></pre>
+</pre>
<h3 id="distance-field"><code>Distance</code> Field</h3>
<p>The <code>Distance</code> field describes the distance between the tool and the touch device
surface. A value of 0.0 indicates direct contact and larger values indicate
@@ -1032,14 +1036,15 @@ increasing distance from the surface.</p>
<p>The default value is <code>1.0</code>.</p>
<h4 id="calculation_4">Calculation</h4>
<p>The calculation of the <code>Distance</code> field depends on the specified calibration parameters.</p>
-<pre><code>If touch.distance.calibration == "scaled":
+<pre class="devsite-click-to-copy">If touch.distance.calibration == "scaled":
output.distance = raw.distance * touch.distance.scale
Else
output.distance = 0
End If
-</code></pre>
+</pre>
<h3 id="example">Example</h3>
-<pre><code># Input device configuration file for a touch screen that supports pressure,
+<pre class="devsite-click-to-copy">
+# Input device configuration file for a touch screen that supports pressure,
# size and orientation. The pressure and size scale factors were obtained
# by measuring the characteristics of the device itself and deriving
# useful approximations based on the resolution of the touch sensor and the
@@ -1070,7 +1075,7 @@ touch.pressure.scale = 0.0125
# Orientation
touch.orientation.calibration = vector
-</code></pre>
+</pre>
<h3 id="compatibility-notes">Compatibility Notes</h3>
<p>The configuration properties for touch devices changed significantly in
Android Ice Cream Sandwich 4.0. <strong>All input device configuration files for touch
@@ -1107,16 +1112,18 @@ layout descriptions either separated by newlines or by colons.</p>
</ul>
<p>All coordinates and sizes are specified in terms of the display coordinate system.</p>
<p>Here is a virtual key map file all written on one line.</p>
-<pre><code># All on one line
+<pre class="devsite-click-to-copy">
+# All on one line
0x01:158:55:835:90:55:0x01:139:172:835:125:55:0x01:102:298:835:115:55:0x01:217:412:835:95:55
-</code></pre>
+</pre>
<p>The same virtual key map file can also be written on multiple lines.</p>
-<pre><code># One key per line
+<pre class="devsite-click-to-copy">
+# One key per line
0x01:158:55:835:90:55
0x01:139:172:835:125:55
0x01:102:298:835:115:55
0x01:217:412:835:95:55
-</code></pre>
+</pre>
<p>In the above example, the touch screen has a resolution of 480x800. Accordingly, all of
the virtual keys have a &lt;centerY&gt; coordinate of 835, which is a little bit below
the visible area of the touch screen.</p>
@@ -1124,20 +1131,22 @@ the visible area of the touch screen.</p>
centerY of <code>835</code>, width of <code>90</code> and height of <code>55</code>.</p>
<h3 id="example_1">Example</h3>
<p>Virtual key map file: <code>/sys/board_properties/virtualkeys.touchyfeely</code>.</p>
-<pre><code>0x01:158:55:835:90:55
+<pre class="devsite-click-to-copy">
+0x01:158:55:835:90:55
0x01:139:172:835:125:55
0x01:102:298:835:115:55
0x01:217:412:835:95:55
-</code></pre>
+</pre>
<p>Key layout file: <code>/system/usr/keylayout/touchyfeely.kl</code>.</p>
-<pre><code>key 158 BACK
+<pre class="devsite-click-to-copy">key 158 BACK
key 139 MENU
key 102 HOME
key 217 SEARCH
-</code></pre>
+</pre>
<p>Key character map file: <code>/system/usr/keychars/touchyfeely.kcm</code>.</p>
-<pre><code>type SPECIAL_FUNCTION
-</code></pre>
+<pre class="devsite-click-to-copy">
+type SPECIAL_FUNCTION
+</pre>
<h2 id="indirect-multi-touch-pointer-gestures">Indirect Multi-touch Pointer Gestures</h2>
<p>In pointer mode, the system interprets the following gestures:</p>
<ol>
diff --git a/en/devices/input/validate-keymaps.html b/en/devices/input/validate-keymaps.html
index 4eabb401..9aac7e19 100644
--- a/en/devices/input/validate-keymaps.html
+++ b/en/devices/input/validate-keymaps.html
@@ -29,41 +29,51 @@ maps files and virtual key definition files.</p>
<h2 id="compilation">Compilation</h2>
<p>To compile <code>validatekeymaps</code>, set up the development environment, download
the Android source tree, compile it, then run:</p>
-<pre><code>$ mmm frameworks/base/tools/validatekeymaps
-</code></pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+mmm frameworks/base/tools/validatekeymaps
+</pre>
<p>This command should compile a host tool called validatekeymaps into the
<code>out/host/&lt;os&gt;/bin</code> directory.</p>
<h2 id="usage">Usage</h2>
<p>If you ran <code>envsetup.sh</code> to set up your development environment, then the
<code>validatekeymaps</code> tool should already be on your path. You can verify
this by running <code>validatekeymaps</code>.</p>
-<pre><code>$ validatekeymaps
-
+<pre class="devsite-terminal devsite-click-to-copy">
+validatekeymaps
+</pre>
+<p>You should see the following output:</p>
+<pre>
Keymap Validation Tool
Usage:
validatekeymaps [*.kl] [*.kcm] [*.idc] [virtualkeys.*] [...]
Validates the specified key layouts, key character maps,
input device configurations, or virtual key definitions.
-</code></pre>
-<p>Then all you need to do is run <code>validatekeymaps</code> an give it the path of
+</pre>
+<p>Then all you need to do is run <code>validatekeymaps</code> and give it the path of
one or more files to validate.</p>
-<pre><code>$ validatekeymaps frameworks/base/data/keyboards/Generic.kl
-
+<pre class="devsite-terminal devsite-click-to-copy">
+validatekeymaps frameworks/base/data/keyboards/Generic.kl
+</pre>
+<p>Example:</p>
+<pre>
Validating file 'frameworks/base/data/keyboards/Generic.kl'...
No errors.
Success.
-</code></pre>
+</pre>
<p>And if there is an error...</p>
-<pre><code>$ validatekeymaps Bad.kl
-
+<pre class="devsite-terminal devsite-click-to-copy">
+validatekeymaps Bad.kl
+</pre>
+<p>Example:</p>
+<pre>
Validating file 'Bad.kl'...
E/KeyLayoutMap(87688): Bad.kl:24: Expected keyword, got 'ke'.
Error -22 parsing key layout file.
Failed!
-</code></pre>
+</pre>
<h2 id="automation">Automation</h2>
<p>It is a <em>very</em> good idea to run <code>validatekeymaps</code> on all configuration files
before installing them on a device.</p>
@@ -71,7 +81,8 @@ before installing them on a device.</p>
script or a makefile.</p>
<p>The following sample makefile is based on the contents of
<code>frameworks/base/data/keyboards/Android.mk</code>.</p>
-<pre><code># This makefile performs build time validation of framework keymap files.
+<pre class="devsite-click-to-copy">
+# This makefile performs build time validation of framework keymap files.
LOCAL_PATH := $(call my-dir)
@@ -89,7 +100,7 @@ validate_framework_keymaps: $(files)
$(hide) $(validatekeymaps) $(files)
include $(BUILD_PHONY_PACKAGE)
-</code></pre>
+</pre>
</body>
</html>