refactor key listener CTS tests

This commit introduces KeyListenerTestCase, which contains various
common code used by KeyListener tests, Of special note is that
KeyListenerTestCase.setUp() does not exit until the associated
KeyListenerStubActivity has window focus. This should cleanly fix the
window focus timing issues that are causing this set of CTS tests to
randomly fail.

There has also been a variety of other miscellaneous cleanup and
refactoring performed in the KeyListener tests and elsewhere: Common
code pulled out of similar tests up into the KeyListenerTestCase,
PollingCheck objects checking for window focus, various stylistic
tweaks to unify the various naming conventions and such.

Change-Id: I46004bfac62e56a4e264fd9c484f5846c87354c3
15 files changed