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 2216

Summary: [Android] Duplicate button presses
Product: SDL Reporter: ny00
Component: joystickAssignee: Gabriel Jacobo <gabomdq>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: gabomdq
Version: HG 2.1   
Hardware: All   
OS: Android (All)   

Description ny00 2013-11-07 13:54:42 UTC
Concerning the recent inclusion of joystick support for Android, it is the case that the testjoystick app reports dual button presses. That is, once a gamepad button is pressed, it reports two buttons getting pressed. When released, both are reported as released.

After modifying the java file a bit, it seems like the reason is as follows:

Concerning the function onKey, if a gamepad button press/release is detected, the value of 'true' is *not* returned as expected. Rather, 'false' is returned.

This may result in an additional, synthesized KeyEvent with keycode KEYCODE_DPAD_CENTER, as hinted here:

http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_DPAD_CENTER


So, the fix is: Always return 'true' after handling a gamepad button.
Comment 1 Gabriel Jacobo 2013-11-10 17:21:44 UTC
It seems this got fixed here: http://hg.libsdl.org/SDL/rev/8cff978e06e9