From e65a1c4fde39d025957a29962ebdcbac92f72223 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Tue, 28 Feb 2017 16:52:59 -0800 Subject: [PATCH] Don't limited pinned tasks to content area. During the pinned animation from fullscreen we layout the window for as if it were fullscreen. However this logic determines that we then overlap the content area and unhelpfully tries to adjust us. Test: Manual. Change-Id: I1cbeb47731062f95c631e8cbd1f0601085d1762f --- .../java/com/android/server/wm/WindowState.java | 16 ++++++++++------ 1 file 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 945a349a28fd0..b9466d2d43d05 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 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);