Add hashmap to map input key/scan codes with arbitrary modifiers to out seqs.

Currently used approach of using String[256] doesn't scale - the arrays are
sparse, while there may be need to handle various modifier combinations. For
example, cursor directional keys produce different codes for all combinations
of Ctrl, Alt, and Shift - 8 combinations total. So, just use hash table, but
be efficient and use integer as key value. Caveat with this approach is
exactness of much. For (abstract) example, suppose Ctrl+Shift+PgUp
combination is not supported, while Ctrl+PgUp is. Current implementation will
however output code for just PgUp, while it may make sense to output code for
Ctrl+PgUp (but that's not 100% sure).

Mapping of raw scancodes is also supported. There actually should be support for
reading user-defined map from an external file, then functionality implemented
here will allow users to perfectly support whatever keyboard they have on their
hands, regardless of Android version, regardless of whether some keys are
supported by Android or not, and whether that support broken or not.
Separate "application mode" handling for cursor keys vs keypad.

XTerm and other terminals have separate "application modes" for numeric
keypad block and cursor keys block. A-T-E mixed them together.

Implementation is complicated due to issue
https://github.com/jackpal/Android-Terminal-Emulator/issues/265 : Currently,
terminal emulation is not encapsulated to one class how it would be logical, but
instead split between TerminalEmulator and TermKeyListener. So, this patch adds
"side channel" between these classes to allow TerminalEmulator to control some
aspects of TermKeyListener directly, to avoid routing communication between them
across even more classes. Ideally, terminal-related handling should be refactored
from TermKeyListener into TerminalEmulator (so, TermKeyListener would only handle
receiving events from the underlying OS).

Reference: http://www.xfree86.org/current/ctlseqs.html

This will conflict with https://github.com/jackpal/Android-Terminal-Emulator/pull/266
Add XTerm alt buffer support ("\E[?47h"/"\E[?47l").

Alt buf is used by many fullscreen apps to preserve original contents
of the console. This implementation is pretty basic, but enough to run
Midnight Commander with proper switching between shell and panels.

Reference: http://www.xfree86.org/current/ctlseqs.html
Quick-add additional altbuf command codes to make "less" work.

"\E[?1049h" should probably clear altbuf after all, but so far, "less"
overwrites entire altbuf content itself.

Reference: http://www.xfree86.org/current/ctlseqs.html
Use num keypad for cursor movement, etc. keys. This allows to have Home key.

On some Android versions, Home key unconditionally used to go to Home screen,
so using numpad in cursor key mode is the way to actually have a usable Home
key still. Then, standalone Home key can be redefined to produce numpad's
key code either to get around ugly Android behavior. For reference:

/system/usr/keylayout/bk/Generic.kl:
-key 102   MOVE_HOME
+key 102   NUMPAD_7
Add "xterm" terminal type.
If TERM=xterm, use corresponding codes for Home/End keys.
Use xterm settings as install defaults.
Rename forked package to allow install together with original A-T-E.