Fix race condition in process observer

Summary: There is a race condition in dispatching the changes to the process
observer. When a ProcessChangeItem is initialized and retrieved during
enqueueProcessChangeItemLocked(), the change information will be set
with the handle retrieved. The change item will be processed in the UI
thread via a message.
However, there could be race condition. When the change item is
processed in the UI thread, its actual change information is not yet
populated and hence the dispatch will find no changes and do nothing.
This diff makes creating the ProcessChangeItem to be atomic so that
when the message to process is sent, it will have all the information.

Test: Successful build on master

Signed-off-by: Abdelrahman Daim <adaim@meta.com>

Change-Id: I5e0e5992c41dfd59c23bacdefcd8a294b13fc6be
4 files changed