DescriptionGamepad: 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
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=275378
Patch Set 1 #
Total comments: 11
Patch Set 2 : fix axes on Shield and nits #
Messages
Total messages: 11 (0 generated)
|