Do not sleep activities in focused stack when keyguard is going away

ActivityStack#shouldSleepActivities reports back whether we should
put activities in stack to sleep based on the display state. We
should also consider the keyguard state, as it's possible for a stack
to become visible as the keyguard is disappearing, but before the
display has reported on, such as when we're unlocking by fingerprint.
In this case, sleeping will lead to an extraneous and incorrect
lifecycle shift to stop.

Change-Id: I0f0c8bc90093bf636e5ba9ddce7046da631248b0
Fixes: 74603384
Test: atest FrameworksServicesTests:com.android.server.am.ActivityStackTests#testShouldSleepActivities
4 files changed