As
for the keycode, in Android, each character keycode (K or BACK) is
defined as a fixed constant (KEYCODE_K or KEYCODE_BACK) which has a
fixed value (39 and 4, in these examples). But this information
isn't needed to reassign keys in the key layout file.
To add confusion
to this, the scancode we're talking about here is not the original
scancode that gets sent from the keyboard (presumably USB or
Bluetooth). The original keyboard scancode is converted by the
Linux evdev driver to our scancode.
The whole topic
of keyboard output is complex and confusing, as you can see. If a
PS/2 keyboard is involved - luckily, no Android device ever has to deal
with one - an entire new level of complexity is reached, as there are
three possible sets of scancodes, any one of which can be used by the
keyboard at the request of the operating system, and those need to be
translated by hardware into the primitive scancode that is dealt with
by the evdev driver.