Don't consume all BACK keys in SearchView
If SearchView is the first focusable, it will always get focus (in non-touch-mode) when it tries to clearFocus on BACK pressed. This lead to a situation where SearchView always consumed the BACK key leaving users unable to leave some activities. It looks like this was done so that pressing back both closed the auto-correct popup AND the ime (whereas without reimplementing onPreIme, it would require 1 back-press to close the auto-correct popup and then a subsequenty press to close the IME). It also, however, tried to clearFocus as well. This change only consumes the Back press if the auto-correct popup is open (to have the same effect of BACK closing both the popup and the IME at the same time). It ignores the back press otherwise. If there is no pop-up, this results in the BACK being handled by the ime and thus hiding it. Otherwise, back is not consumed. The only effective difference is that the SearchView remains focused now. Bug: 73181998 Test: SearchView CTS tests still pass. Back can now exit test-app once IME is hidden. Change-Id: I3fe687b5344300b86131f44a1c9798cd736955bd
Loading
Please register or sign in to comment