Keyguard: use transition state for syncing occlude [RESTRICT AUTOMERGE]

Previously keyguard occlude state was passed in onAnimationCancelled
which was not reliable for two reasons:

 (1) onAnimationCancelled is not called if the animation immediately
 finishes itself due to unhappiness at the contents of the transition
 it's been asked to play (eg. empty app list)

 (2) Clients have inconsistent handling of that paramter - some ignore
 it, some respect it, one may get passed wrong information by a local
 caller in mergeAnimation.

Instead note the Keyguard flags at the start of every app transition
and queue up a call to setKeyguardOccluded if the transition may cause a
change. This should be sent after the animation is already finished.

This is ideally similar to 140a05907d905e38aa5690320d26c90ca29bf772
(Run keyguard occlusion update after transitions) which was done for
WmShell transitions.

Test: atest KeyguardTests
Test: atest ActivityLifecycleKeyguardTests
Test: atest MultiDisplayKeyguardTests
Test: atest MultiDisplayLockedKeyguardTests
Bug: 286099078
Change-Id: Ifcdac241bfe33f44f5f03f1a6db682c57f0cd388
2 files changed