Check isOnScreen for wallpaper target of recents animation

If an unresponsive activity is launched by recents activity.
WindowState#mDestroying of recents activity will be set until
the exit animation is done. But because the next app is slow,
before the transition is done, when starting the recents activity
again, if it is set as wallpaper target, WallpaperController#
updateWallpaperVisibility/isWallpaperVisible will make wallpaper
window visible. But the later layout procedure calls WidowState#
prepareSurfaceLocked that checks WindowState#isOnScreen to
decide whether to hide the wallpaper. And since mDestroying is
still true, isOnScreen will return false that leads to hide
wallpaper. Then the visibility change of wallpaper becomes a loop
that causes layout repeats.

This change makes the condition of wallpaper target for recents
animation consistent with normal case. That means the recents
activity will be wallpaper target until its relayout with visible
state that clears mDestroying.

Bug: 174417869
Test: Assume home is the recents activity, launch an activity
      which sleep 10s in onCreate from home, and then swipe
      up by gesture navigation. There should not appear log
      message "Performed 6 layouts in a row. Skipping".
Change-Id: I8982657bbe04a01406b50a6a2f32d34d33f560d4
2 files changed