diff options
author | Galia Peycheva <galinap@google.com> | 2021-02-06 13:00:14 +0100 |
---|---|---|
committer | Galia Peycheva <galinap@google.com> | 2021-02-25 18:33:33 +0100 |
commit | d129f1e00ef7de136908dce9e74fd7e23adcaf22 (patch) | |
tree | f7fff6e67aca2944dc84d806e1e706314a55687e /tools/aapt2/java/JavaClassGenerator_test.cpp | |
parent | 09f52aa440ab32e66dfabeb4cb40b72166930b4f (diff) |
Fix synchronisation in BackgroundBlurDrawable
The PositionUpdateListener in BackgroundBlurDrawable is called from
a thread pool to update the position of the BlurRegion. After that,
in frame drawing callback (RenderThread), the Aggregator takes all
the settings in BackgroundBlurDrawable and dispatches them to SF.
However, while the RenderThread is working on frame N, the Ui thread
is working on frame N+1. So when the frame drawing callback is
called on RenderThread for frame N, BackgroundBlurDrawable
might already be holding settings for frame N+1.
In this CL, we fix that by making BackgroundBlurDrawable work only on Ui
thread, while BlurRegion lives only on RenderThread. Just before
drawing, we copy the state of BackgroundBlurDrawable into a BlurRegion.
So when render thread starts doing its thing for frame N, Ui thread can
start setting up BackgroundBlurDrawable for frame N+1. The settings for
frame N are already copied over to BlurRegion. In frame drawing
callback, we take the blur regions if there is a pending update and send
them to SF.
Bug: 167166562
Test: m && atest BlurAggregatorTest
Change-Id: Icec0fa8e97de30b7bad15b97f848ae642076652f
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
0 files changed, 0 insertions, 0 deletions