Improve handling of focus behaviour on Android. Patch by Alexey Petruchik