Choreographer 是用来控制同步处理输入(Input)、动画(Animation)、绘制(Draw)三个操作(UI 显示的时候每一帧要完成的事情只有这三种)。其内部维护着一个 Queue,使用者可以通过 postXxx 来把一系列待运行的 UI 操作放到 Queue 中。这些事件会在 Choreographer 接收 VSYNC 信号后执行这些操作,比如 ViewRootImpl 对于 ViewTree 的更新事件:
// ViewRootImpl
void scheduleTraversals() {
...
mChoreographer.postCallback(Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null);
}