Update wallpaper target if the current target is gone

The condition was not accurate that a window with wallpaper
flag doesn't mean it is the wallpaper target. And a window
can be wallpaper target without wallpaper flag such as
animating task by recents.

Fixes: 212940778
Fixes: 234206675
Test: atest WallpaperControllerTests#testUpdateWallpaperTarget
Test: Swipe up a task with 2 activities. And after the top one
      is terminated, the wallpaper should be still visible.

Change-Id: Ia861c44cfba448fe6aab0b6ea72595e9ab3a2a6f
2 files changed