Ignore non-existent displays in #topRunningActivityLocked.

Previous changes aimed at driving display creation through
ActivityManagerService. However, there are still cases where
WindowManagerService will encounter the display first (such as add
window). A subsequent changelist enabled this out of band creation.
As a result the WindowManagerService and ActivityManagerService can
still have different lists of displays. This mismatch leads to
#topRunningActivityLocked processing null ActivityDisplays.

This changelist skips over displays not yet encountered by
ActivityManagerService in #topRunningActivityLocked. Such displays
have no stacks and therefore no activities that could be the top
running activity.

Test: atest FrameworksServicesTests:com.android.server.am.ActivityStackSupervisorTests#testTopRunningActivityLockedWithNonExistentDisplay
Fixes: 74593710
Change-Id: I316e5305f7ce233a04ecf18d605eebdf723b0920
2 files changed