Render View into Bitmap using hardware acceleration (1/2)
This CLs switches the screenshot tests to render using hardware
rendering rather than software rendering. The reason for this is that
some features are not supported in software rendering (like clipping to
an outline).
Even though hardware rendering are not meant to be 100% deterministic
(e.g. shadows and ripples), I'd like us to try to still go for
pixel-perfect matching of screenshots whenever possible, especially
given that we don't really care about testing things like
shadows/elevation. In the future, we might either use software rendering
or more lenient matchers in case we want to test some UIs that are
impossible to make deterministic.
Because the AndroidX View.captureToBitmap() API unfortunately does not
work for dialogs (see b/195673633), I had to fork ViewCapture.kt and
WindowCapture.kt to ensure that we use the correct window we are sending
over to PixelCopy for the hardware rendering.
Bug: 230832101
Test: atest SystemUIGoogleScreenshotTests
Change-Id: I8cb6398c0c446b754d5c1af27296a18d53ce738e
6 files changed