Gamepad: cleanup mappings and add support for Samsung and PS3 gamepads
The way we map axes does not look quite correct to me. We rely on the ordering in which InputDevice enumerates the motion ranges. There are several problems with that. First, I don't find any evidence in the documentation that there is a defined ordering. This means that InputDevice.getMotionRanges() does not guarantee to enumerate the axes in the same order on different devices or in different api versions. Second, this leads to using magic constants. Third, ideally one should be able to add the code for a new device or at least check if it is correct by looking at the Android specific documentation of the device. But those documentations refer to api constants like MotionEvent.AXIS_FOO instead of the index of the motion range. This CL cleans it up by storing the axes values associatively indexed by api constants, just like we do for buttons. Finally, it adds the device specific code for the Samsung and the PS3 gamepads. TEST=http://www.html5rocks.com/en/tutorials/doodles/gamepad/gamepad-tester/tester.html BUG=330094 Review URL: https://codereview.chromium.org/307413004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275378 0039d316-1c4b-4281-b951-d872f2087c98
Showing
Please register or sign in to comment