Fix issue #5823276 again: home repaints after full-screen app is exited

Don't consider a window as a candidate for the top fullscreen window
if it is not going to be a candiate for layout.

This fix does not include the change to ignore app tokens that are
hidden.  This causes problems in some dialogs that stay hidden until
their app is ready to display, but need to perform a series of relayouts
during that time to get to the right size.  Dropping this part of
the change still (mostly?) seems to allow us to avoid the bad states.

Change-Id: Ic052cb1499d3287f47e9ffeac5cd2470ee5a308c
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index 75bda41..9118381 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -1444,6 +1444,16 @@
                     || mAnimating);
     }
 
+    public boolean isGoneForLayoutLw() {
+        final AppWindowToken atoken = mAppToken;
+        return mViewVisibility == View.GONE
+                || !mRelayoutCalled
+                || (atoken == null && mRootToken.hidden)
+                || (atoken != null && atoken.hiddenRequested)
+                || mAttachedHidden
+                || mExiting || mDestroying;
+    }
+
     /**
      * Returns true if the window has a surface that it has drawn a
      * complete UI in to.