diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowState.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 945a349a28fd..b9466d2d43d0 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -844,20 +844,24 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // Make sure the content and visible frames are inside of the // final window frame. if (windowsAreFloating && !mFrame.isEmpty()) { + // For pinned workspace the frame isn't limited in any particular + // way since SystemUI controls the bounds. For freeform however + // we want to keep things inside the content frame. + final Rect limitFrame = task.inPinnedWorkspace() ? mFrame : mContentFrame; // Keep the frame out of the blocked system area, limit it in size to the content area // and make sure that there is always a minimum visible so that the user can drag it // into a usable area.. - final int height = Math.min(mFrame.height(), mContentFrame.height()); - final int width = Math.min(mContentFrame.width(), mFrame.width()); + final int height = Math.min(mFrame.height(), limitFrame.height()); + final int width = Math.min(limitFrame.width(), mFrame.width()); final DisplayMetrics displayMetrics = getDisplayContent().getDisplayMetrics(); final int minVisibleHeight = Math.min(height, WindowManagerService.dipToPixel( MINIMUM_VISIBLE_HEIGHT_IN_DP, displayMetrics)); final int minVisibleWidth = Math.min(width, WindowManagerService.dipToPixel( MINIMUM_VISIBLE_WIDTH_IN_DP, displayMetrics)); - final int top = Math.max(mContentFrame.top, - Math.min(mFrame.top, mContentFrame.bottom - minVisibleHeight)); - final int left = Math.max(mContentFrame.left + minVisibleWidth - width, - Math.min(mFrame.left, mContentFrame.right - minVisibleWidth)); + final int top = Math.max(limitFrame.top, + Math.min(mFrame.top, limitFrame.bottom - minVisibleHeight)); + final int left = Math.max(limitFrame.left + minVisibleWidth - width, + Math.min(mFrame.left, limitFrame.right - minVisibleWidth)); mFrame.set(left, top, left + width, top + height); mContentFrame.set(mFrame); mVisibleFrame.set(mContentFrame); |