We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4191

Summary: SDL_StartTextInput() mangles Android joystick input
Product: SDL Reporter: RobLM <rob.l.molenaar>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.7   
Hardware: ARM   
OS: Android (All)   

Description RobLM 2018-06-08 13:09:10 UTC
Joystick (game controller) events are limited and mangled after calling SDL_StartTextInput() on Android. This might be due to the OS entering 'text input mode'. Apps also generate a lot of ANRs (6000ms UI timeout warnings) while processing joystick events afterwards.

On my phone and game controller only the left stick and D-pad generate any events in the mangled mode, with the D-pad sending wrong axis IDs. The adb log is also spammed with ANRs.

I solved this by adding:
mLayout.removeView(mTextEdit);

To the SDLActivity SDLCommandHandler 'COMMAND_TEXTEDIT_HIDE' case so the DummyEdit is completely removed from the UI stack. This way regular joystick control resumes after finishing text entry. It would be nice however to find a way to make joystick buttons and axes work during text entry as well.
Comment 1 RobLM 2018-06-09 13:30:50 UTC
After more testing, it turns out that my previous fix prevents the soft keyboard showing for successive calls to SDL_StartTextInput().

Unfocusing the text field using 'mLayout.requestFocus();' seems to work as a better fix. It re-enables joystick events and doesn't permanently hide the soft keyboard.