SurfaceView: Fix unsafe transaction accesses

PositionUpdateListener callbacks maybe replaced before they
are applied. We need to merge with the existing transaction
so we don't drop any destination frame updates. But accessing
the previous callback transaction is unsafe since we might fight
with render thread.

Fix this by locking access to the transaction object.

This also fixes a potential SurfaceControl access issue where
we may release the SurfaceControl that is used by render thread
in the UI thread.

Fixes: 211090247
Test: atest SurfaceViewSyncTest
Change-Id: I28ed344754601169c6cefd919668e76ef5a467c3
(cherry picked from commit 894fa8809a71923aaa5920f79c1b70405b4a7e64)
1 file changed