Android Gingerbread Fixes Long Time Touch Events Bug, Prepare for a Wave of Games


Staff member
Jul 9, 2010

One of the most exciting features of Android 2.3, Gingerbread, is game development, which is the first point mentioned in the Android 2.3 video.

In particular, Android 2.3 fixes a long time Android bug that hindered the performance of device when the touchscreen is used. This is especially a problem in touch-controlled gaming applications.

If you are a developer, you may have already been following the touch events problem that has been plaguing Android since its inception on Google Code. The problem affects every Android device on the market, and is summarized below:

Summary: system_server uses abnormally high CPU processing touch (motion)
events, particularly when the touch point is being moved.
This bug alone accounted for developers delaying the release of their games, because of poor performance when using the touchscreen.

Here are some of the threads started by developers that brought awareness of the issue in the first place:
This is just one of the new features Gingerbread brings to the table for game developers. Here's the full excerpt of one of Google's software engineers explaining what this means:
The Gingerbread SDK was released today!

One of the major new features in Gingerbread is a complete rewrite of the input dispatch pipeline. The CPU usage and latency for processing touches and keys has been significantly improved. These benefits apply to all applications running on Gingerbread. In other words, your applications will process input faster without requiring any extra effort on your part when running on a Gingerbread based device.

In Gingerbread, we also added new NDK APIs for receiving input from native code. Together with the native activity lifecycle, sensors, audio and graphics APIs, it is now possible to write native applications that contain very little Dalvik code of your own (or even none at all).

Here are some other new features that you might find interesting.

MotionEvents now carry the size of the touch contact area in pixels. Look for the new touchMajor, touchMinor, toolMajor, toolMinor and orientation properties. You can easily test this using the Pointer Location tool by pressing a conductive object of known size like a penny up to the screen. On a properly calibrated device, the circle or ellipse that represents the touch area will closely circumscribe the penny.

The pressure calibration is also somewhat better. Applications can distinguish typical small featherlight brushes from full finger touches. However, since the device can't actually measure pressure directly we use a simple approximation based on the signal strength. The approximation is inaccurate but it turns out to be good enough for some purposes. The Touch Paint API Demo has been upgraded to demonstrate this feature.

So before anyone writes off Android 2.3 and the Nexus S, they better reconsider what this means for the platform.