Multi-Touch is borked!

Yes it really is. Check out this video

This is a simple demo were i register multi-touch events and do polling later on to draw the rectangles at their locations. Here’s the code that handles the multi-touch events:

In the first couple of lines i extract the pointer ID along with the touch event action itself. It’s just some silly bit shifting, you can figure out the details by looking at the MotionEvent class. Next i react to the events and fill the three arrays touchX[], touchY[] and touched[] accordingly. In my rendering thread i poll those three arrays and draw a Rectangle for each entry that has touched[] set. Simple.

Now the problem is pretty easily reproduceable. Touch with the left thumb, hold it and touch with the right thumb, release the left thumb and put it down again. The x-coordinate for the left thumb get’s messed up. In LogCat one can see messages from the class InputDevice saying that a bad pointer was dropped. I had a brief look at that class in the Android sources and it seems to be a bit messy. Lots of magic numbers and so on.

I reported this issue twice on the mailing list here and here and confirmed the issue on the Milestone/Droid. Robert Green from Battery Powered Games told me yesterday that he has the same issues on his Nexus One, so did Markus Junginger from Green Robot. Robert also filled a bug report here.

In this thread Dianne Hackborn, an Android framework developer stated that This is how the sensor hardware works. It is essentially the same sensor as
the G1 and myTouch. Please don’t file a bug about it.
which is quiet interesting considering that the problem must have been obvious in their tests. One of the example codes from the threads above is actually a framework example included in the Android sources and the problem is easily noticeable.

It’s really a bit sad to have such a crippled version of multi-touch on Android. I really can’t blame anyone as the situation is a bit unclear. Is it the drivers or the framework interpreting the driver output? Seeing the comment by Dianne makes me wonder if there’s ever going to be a fix for this.

For now multi-touch enabled games are out of the window :/

Leave a Reply

Your email address will not be published.