Android UI Internal: The Design of SurfaceFlinger , Design Pattern's perspective

This slide was for a training I conducted around a year ago for our internal team and I feel more people might find it useful, especially those who also works in Android graphic framework.

Android native graphic system, with SurfaceFinger sitting in the center, is rather sophisticated and it takes time to fully appreciate how all pieces working together. Despite of the complexity, I often marvel at the elegance of the whole architecture design. To active this elegance,  design patterns play a critical role.


In this presentation, I introduced several design patterns: Observer, Proxy, Command Pattern, Thread Pool, Producer-Consumer, and Active Object. The first three are introduced in GOF classic . The last three are concurrent patterns and you may want to goole a little bit.  Furthermore, I illustrated how SurfaceFlinger utilized and evolved those pattens to build a larger architecture to meet the requirements needed by graphic system. I also explained the sequence of how an update in user application trigged the composition of SurfaceFlinger - a user case that links every pieces together.

I wish you find it useful.