appium/appium-adb — pull request #56 by amake (2014-10-30 05:02:39+00:00)
Title: Make isSoftKeyboardPresent correctly detect keyboards with no UI

Currently, `isSoftKeyboardPresent` detects the presence of a keyboard by looking for `mInputShown=true` in the output of `dumpsys input_method`. However, this flag is `true` even in cases where there is no keyboard UI displayed, such as when using a hardware keyboard or the Appium UnicodeIME.

I looked at `dumpsys input_method` output for the following situations:
- [Software keyboard + stock IME](https://gist.github.com/amake/5daa9d869702acc38162) (safe to go back)
- [Software keyboard + UnicodeIME](https://gist.github.com/amake/038d8a661e3c2a56553f) (not safe)
- [Hardware keyboard + stock IME](https://gist.github.com/amake/6a12b97bf6f277f60883) (not safe)
- [Hardware keyboard + UnicodeIME](https://gist.github.com/amake/6a8f2b22e71a69c1b0dd) (not safe)

It appears that `mIsInputViewShown` is the correct flag to look at to determine if it is safe to use the back button. This flag is present back to at least API level 17 (I didn't check before that).

This patch switches the current implementation to use this flag instead. This would at least partially address these issues:
appium/appium#3884
appium/appium#3903