Layoutlib: Animation support.

New locking mechanims to prevent concurrent renderings.

There's now a thread specific prepareThread() method (only
prepares the looper) and its associated cleanupThread().

For the rendering itself, acquire must be called before doing
any type of Android specific work on the scene (inflate or rendering)
After instantiation, init() must be called, which also acts as acquire.

Added a lot of checks to make sure method aren't called without
acquire or if scenes try to be rendered while acquire was called
from the same thread but on another scene.

Animation implementation:
- Handler delegate to use our own queue (since the animation runs
  through handler messages). This uses a callback to process
  the message. This callback is per-thread and only used in
  animation threads.
- SystemClock delegate to provide clock implementation.
- AnimationThread to handle playing the animation and calling back
  to the animation listener.

Change-Id: Ia39aba7ed476759df1da3200e413fe3e92590d15
10 files changed