Avoid applying unexpected sync state when checking sync finish
For example:
A task launch transition is completed so its window finishes sync
to SYNC_STATE_NONE. And then a new activity X is launching in the
same task (given sync-group{X}). If a code path accidentally invokes
isSyncFinished to check a window that isn't in the sync-group, e.g.
the window of previous activity, then prepareSync will still be called
and change the sync state to SYNC_STATE_WAITING_FOR_DRAW.
And later when removing the window without sync-group, an exception
will be thrown by not SYNC_STATE_NONE.
So when checking isSyncFinished, if there is no sync-group from
ancestor, then behave as a getter function.
Also tweak getSyncGroup a bit to reduce method invocation.
Fix: 318642514
Test: atest SyncEngineTests#testWaitingSyncCallback
Change-Id: Idd1bc09eb9bdec1a8b0ba44fa34f417f2fa92102
2 files changed