Android Goodies

I joined Android in May 2005, about six weeks before the company was acquired by Google. I spent the next nine years working on Android, setting a new personal record for employment at a single company.

One of the things I did in the very early days was fix up the build system, which was initially little more than a collection of shell scripts. The new system supported multiple build targets (local & cross), automatic dependency generation, static and dynamic libraries, and worked with GNU make on Linux, Cygwin, and (mostly) Mac OS X. The primary drawback was that it was based on recursive Makefiles, which have significant drawbacks for large projects, so it was only around for a few months. The build rules, with some sample files, were packaged up as FMS (fadden's Makefile System) and placed in the public domain (download).

I spent the majority of my time at Google working on the Dalvik virtual machine, which was a lot of fun but doesn't make for visually interesting demos.  It did lead me to create a rather long document on the joys of weak memory consistency. And it led to my appearance on the stand in a patent lawsuit.

My last couple of years on Android were spent on the system-level graphics team.  If you don't know what that means -- and, really, few people inside or outside the company do -- I wrote a document describing the piece of the puzzle that the graphics team was responsible for.


As I was transitioning to the graphics team I figured I ought to learn something about OpenGL ES, so I wrote a small but complete game called Android Breakout.  I figured it would be useful to others as sample code, so I commented it heavily, and got permission from Google to publish it as open-source software.  The game was inspired by Little Brick Out, a game included with early Apple II systems.

After being on the graphics team for a bit, I got involved with the intersection of graphics and video playback.  When I started working with the Android MediaCodec class I discovered that there wasn't much sample code available (this is in late 2012, around when 4.2 "Jelly Bean #2" shipped and development on 4.3 "Jellybean #3" was moving along), so I started putting bits of code and helpful hints up on my own site.

Once the basics were covered I started exploring what else I could do -- partly out of personal interest, and partly because every time I started to push the boundaries I found something that needed to be fixed. I wanted an app that I could use for testing, but also publish externally for developers to try on their own devices, and potentially use as sample code.  Once again, Google granted permission to release code written on company time and equipment as open-source software.


The primary goal of Grafika ("graphics" in Polish) was to exercise different parts of the Android graphics and media APIs.  None of the activities do anything outwardly elaborate, but some of them push the API in slightly unusual ways.  For example, I had recently spent time working on the Android screenrecord command (which started as an internal "let's see if this works" project, but turned out to be so handy that we made it official), so I decided to play with it in Grafika by sending OpenGL ES rendering to the video encoder.  In a "normal" app you'd figure out something that worked and just run with it, but for Grafika I implemented it three different ways and added UI elements to switch between them on the fly.  And, in doing so, found that the graphics drivers on most devices had bugs that prevented one of the approaches from working at all.

Some videos of Grafika in action: camera filter demo (I love combining live video from the camera with GPU processing) and hardware scaler exerciser.

I've used Grafika as an example in dozens (hundreds?) of answers and comments on stackoverflow.  Many other companies are so concerned about intellectual property that doing something like this would have been very difficult.  Code would have to go through a developer support organization, with review and approval from legal for every update.  At Google I built the first version, went through the open-source release process, and once I had permission I was free to run with it.

[android-logo]Incidentally, the official-ish name of the iconic Android is "bugdroid". I called it that because it looked like a bug.  (Brian Swetland and I aren't 100% sure which of us came up with the name -- we were sharing an office at the time, so some amount of brain leakage is inevitable -- but the oldest occurrence I can find in mail archives was from me. Neither of us had anything to do with the creation of the graphic.)