Don't log received data char by char, log as a string.

One log entry per char doesn't scale to debugging real-world full-screen
apps - many log lines just overwrite previously logged content.
Log output codes produced by keypresses, symmetrical to logging input data.
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 if raw scancodes is also supported. There actually should be support for
reading user-defined map from external file, then functionality implemented here
will allow users to perfectly support whatever keyboard they have on their hands,
regardless of Android version, if some keys are supported by Android or not, and
if that support broken or not.
My implementation of proper "application mode" for cursor keys.

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, byt enough to run
Midnight Commander with proper switching between shell and panels.
Hack-add additional altbug command codes to make less work.

1049 probably should probably clear altbuf after all, but so far, less
itself overwrites entire altbug content itself.
Use XTerm codes for Home/End keys.

TODO: introduce xterm term time, set codes conditionally.