Bitmap getBitmap(RecordBuilderImpl recordBuilder) {
    if (recordBuilder.getTiling().getAt(0, 0) != null) {
      throw new IllegalArgumentException("can't call getBitmap() after record()");
    }

    View view = recordBuilder.getView();
    Bitmap bmp = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);

    WindowAttachment.Detacher detacher = WindowAttachment.dispatchAttach(recordBuilder.getView());
    try {
      drawClippedView(view, 0, 0, new Canvas(bmp));
    } finally {
      detacher.detach();
    }

    return bmp;
  }
Records the RecordBuilderImpl, and verifies if required
core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotImpl.java