wealthfront/screencaptor

Use PixelCopy instead of View.draw(Canvas)

Closed this issue · 1 comments

note, requires API 24.

Docs:

For software-rendered snapshots of a small part of the View hierarchy or individual Views it is recommended to create a Canvas from either a Bitmap or Picture and call draw(android.graphics.Canvas) on the View. However these software-rendered usages are discouraged and have compatibility issues with hardware-only rendering features such as Config.HARDWARE bitmaps, real-time shadows, and outline clipping. For screenshots of the UI for feedback reports or unit testing the PixelCopy API is recommended.

PixelCopy didn't play nicely with Robolectric screenshotting in my tests