Consider lock state when determining next activity to become visible.

When an activity shown on top of the lock screen finishes, the next
activity to become visible is considered. This activity is determined
by the supervisor's top running activity. When the focused stack does
not have a top running activity, the top most non-focused stack's
top running activity is considered. In the case the device is locked,
this value may be an activity that does not show on lock screen. As
a result, the finishing activity will wait indefinitely for an
activity that will never appear.

This changelist introduces the ability to ask for the top running
activity taking the current locked state into consideration. When
locked, only activities that can show on top of the lock screen will
be returned if we consider non-focused stacks.

Change-Id: I235e345c0b1d255b44d147bc71069c164389db4f
Fixes: 76424176
Test: atest FrameworksServicesTests:com.android.server.am.ActivityStackSupervisorTests#testNonFocusedTopRunningActivity
4 files changed