Reland "Optimize magnifier viewport drawing"
1. Reduce the number of drawIfNeeded calls in fullscreen mode by 99%.
Because updateMagnificationSpec -> setMagnifiedRegionBorderShown will
be called with motion events when changing zoom. Then even if the
border region is not changed, it still always forces redraw. So simply
skip if the border shown state is not changed.
2. Only apply surface transaction if related attributes are changed.
3. drawIfNeeded was always called inside WM lock, so the change [1]
didn't work. With this change, drawIfNeeded is still called on the
same animation thread but it is executed from message directly,
then the change [1] can take effect that avoids holding WM lock
when calling lockCanvas.
AccessibilityMagnificationTest was highly flaky by "mSurface.release()"
in releaseSurface is called on other thread. This reland fixes it
by also posting the cleanup to the same thread.
[1]: Id828744c8c5bcb4bdb3be9a11810338614b84b2e
Bug: 276845499
Bug: 316075123
Bug: 318327737
Test: atest WindowManagerServiceTests#testDrawMagnifiedViewport
Test: atest AccessibilityMagnificationTest --rerun-until-failure 10
Change-Id: I7b6559e10db3dcea0352f17b81e5537b711a18c5
3 files changed