Cancel search on BACK if IME is obscured.

This adds a hidden method AutoCompleteTextView.isImeHidden(),
and uses that in SearchDialog to cancel the search dialog
when BACK is pressed, if there is no previous search component
to return to.

mlebeau says:
 If we fill the whole screen then it makes the issue of the back
 button a little more important. Specifically, right now if you have
 the list expanded and you press back, the keyboard hides but it's not
 really showing any more anyway so it seems like pressing the button
 does nothing. We rationalized this by saying "part of the keyboard
 will be showing so it won't be completely non-obvious that it was
 hidden". But since really the right UX is to fill the screen, as part
 of this we should probably also add logic to the back button such
 that if it is pressed when the list is obscuring the keyboard
 (i.e. softInputMode on the PopupWindow is INPUT_METHOD_NOT_NEEDED)
 then we should hide the dialog entirely rather than closing the
 keyboard.

This is part of the fix for http://b/issue?id=2014450
2 files changed