Fit all non base windows to display instead of just children.

If you want to layout a dialog offscreen you should need
FLAG_NO_LIMITS, otherwise we should adjust you or clip
you to the display as requested by gravity flags. This makes
the docked behavior match freeform. I'm not totally sure why
base application windows still can't be fit to display outside of
fullscreen, it has to do with drag resizing IIRC.

Bug: 30225290
Change-Id: Iebecf5f12359ac0d4b7ea3f08d360fde93046fa9
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 21d02f8..b1cfa38 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -2757,12 +2757,12 @@
         // We need to fit it to the display if either
         // a) The task is fullscreen, or we don't have a task (we assume fullscreen for the taskless
         // windows)
-        // b) If it's a child window, we also need to fit it to the display unless
-        // FLAG_LAYOUT_NO_LIMITS is set. This is so we place Popup and similar windows on screen,
+        // b) If it's a secondary app window, we also need to fit it to the display unless
+        // FLAG_LAYOUT_NO_LIMITS is set. This is so we place Popups, dialogs, and similar windows on screen,
         // but SurfaceViews want to be always at a specific location so we don't fit it to the
         // display.
         final boolean fitToDisplay = (task == null || !nonFullscreenTask)
-                || (mIsChildWindow && !noLimits);
+                || ((mAttrs.type != TYPE_BASE_APPLICATION) && !noLimits);
         float x, y;
         int w,h;