viewcapture: guarantee happens-before relationship

Turn ViewPropertyRef#captured into a volatile field to rule out a
possibly missing happens-before relationship, which could explain
the null pointer exceptions observed in b/375005884.

The main thread's write and the bg thread's read of the volatile field
become a synchronization point across which prior main thread's writes
and subsequent bg thread's reads cannot be reordered.

This ensures that bg thread is observing all the main thread's writes
performed on the ViewPropertyRef instances passed from main to bg.

Bug: 375005884
Flag: EXEMPT bugfix
Test: enable viewcapture on sysui windows and check the NPE \
	doesn't happen anymore on presubmit
Change-Id: I0329fb563657a9e355099feda7d89c24771ae4d4
1 file changed