在view开始绘制之前,首先会在ViewRootImpl创建一个Surface;但是它只是一个空壳;
final Surface mSurface = new Surface();
public Surface() {
}
public Surface(SurfaceTexture surfaceTexture) {
if (surfaceTexture == null) {
throw new IllegalArgumentException("surfaceTexture must not be null");
}
当view开始performTraversals的时候,会执行relayoutWindow操作
...
final int surfaceGenerationId = mSurface.getGenerationId();
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
if (!mDrawDuringWindowsAnimating &&
(relayoutResult & WindowManagerGlobal.RELAYOUT_RES_ANIMATING) != 0) {
mWindowsAnimating = true;
}
...
<