Ice Cream Sandwich puts additional debug tools in the hands of developers

William J. Francis lists his top five "new" developer features on Ice Cream Sandwich and urges you to try them.

It's been over six months since Google released Ice Cream Sandwich (ICS), touted as the most ambitious overhaul of the popular operating system since Android's debut on the good old G1. As of May 1, 2012 Google reports ICS has only penetrated about 5% of Android powered devices (Figure A). Figure A

Source: Google's Android Developers site
However anyone who has used ICS over its more popular Gingerbread predecessor knows it's only a matter of time. ICS is slick and, after you spend a few days on it as a user, it's hard to do without. The same can be said of development on Android 4.x. ICS has a plethora of API, widget, and UI improvements that as a developer I've come to depend on. One such improvement is the enhanced Developer Options menu found under the device settings (Figure B). Figure B

In particular, five of the Developer Options have found their way into my daily workflow.

1. Strict Mode Enabled

If you've programmed on Android for more than a day, you know all about its single UI thread and how janky the UX becomes if you fail to throw each and every long running I/O onto an async task. Turning on Strict Mode will cause the screen to flash each time the currently running application monopolizes the UI thread. It's a very effective means to police oneself, and I now make a point to profile all my apps this way.

2. Pointer Location As the name implies, enabling this option gives you X and Y coordinates and even draws a "trace" line as you drag your finger across the screen. At times, turning this feature on is extremely handy (Figure C). Figure C

3. Show Touches Similar to the Pointer Location option, enabling Show Touches will render a glowing orb each time your finger makes contact with the device's LCD. (Figure D). Figure D

4. Show Screen Updates

Perhaps my favorite of all the ICS debugger goodies, enabling Show Screen Updates causes the screen to flash every time a repaint occurs. The flash is specific to a view. In other words, if the whole screen repaints, the whole screen flashes; if only a text view paints, just that text view flashes. It doesn't take long to realize how instrumental this capability can be in optimizing draw cycles of complex view trees.

Words of caution: My experience running this option on tablet devices has been a mixed bag. In some cases the screen did not flash, and on one particular well-known tablet (rhymes with doom) the device locked up each and every time I tried to show screen updates. Fortunately, most Developer Options aren't sticky, so a reboot of the device restores the defaults.

5. Show CPU Usage While the name is a little misleading since it shows a list of applications rather than actual percentages of processor utilization, it is still useful to get a real-time bird's eye view of what activities are currently active on the device (Figure E). Figure E

I'm sure there are good uses for a number of the other Developer Options as well, and if you are currently using one I didn't mention I'd love to hear more about why and how. For those of you who haven't yet dug into the ICS Developer Options, I urge you to try it. You'll be surprised how quickly these tools will become an integrated part of your development and debugging process.

By William J. Francis

William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intellige...