Loading services/core/java/com/android/server/wm/Task.java +6 −1 Original line number Diff line number Diff line Loading @@ -2924,7 +2924,12 @@ class Task extends WindowContainer<WindowContainer> { } boolean cropWindowsToStackBounds() { return isResizeable(); // Don't crop HOME/RECENTS windows to stack bounds. This is because in split-screen // they extend past their stack and sysui uses the stack surface to control cropping. // TODO(b/158242495): get rid of this when drag/drop can use surface bounds. final boolean isTopHomeOrRecents = (isActivityTypeHome() || isActivityTypeRecents()) && getRootTask().getTopMostTask() == this; return isResizeable() && !isTopHomeOrRecents; } /** Loading services/core/java/com/android/server/wm/TaskDisplayArea.java +9 −0 Original line number Diff line number Diff line Loading @@ -207,6 +207,15 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { return mRootSplitScreenPrimaryTask; } ActivityStack getRootSplitScreenSecondaryTask() { for (int i = mChildren.size() - 1; i >= 0; --i) { if (mChildren.get(i).inSplitScreenSecondaryWindowingMode()) { return mChildren.get(i); } } return null; } ArrayList<Task> getVisibleTasks() { final ArrayList<Task> visibleTasks = new ArrayList<>(); forAllTasks(task -> { Loading services/core/java/com/android/server/wm/WindowState.java +37 −0 Original line number Diff line number Diff line Loading @@ -1528,6 +1528,29 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP && dc != null ? dc.getDefaultTaskDisplayArea().getRootHomeTask() : null; } /** * This is a form of rectangle "difference". It cut off each dimension of rect by the amount * that toRemove is "pushing into" it from the outside. Any dimension that fully contains * toRemove won't change. */ private void cutRect(Rect rect, Rect toRemove) { if (toRemove.isEmpty()) return; if (toRemove.top < rect.bottom && toRemove.bottom > rect.top) { if (toRemove.right >= rect.right && toRemove.left >= rect.left) { rect.right = toRemove.left; } else if (toRemove.left <= rect.left && toRemove.right <= rect.right) { rect.left = toRemove.right; } } if (toRemove.left < rect.right && toRemove.right > rect.left) { if (toRemove.bottom >= rect.bottom && toRemove.top >= rect.top) { rect.bottom = toRemove.top; } else if (toRemove.top <= rect.top && toRemove.bottom <= rect.bottom) { rect.top = toRemove.bottom; } } } /** * Retrieves the visible bounds of the window. * @param bounds The rect which gets the bounds. Loading @@ -1544,6 +1567,20 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } else { intersectWithStackBounds = false; } if (inSplitScreenPrimaryWindowingMode()) { // If this is in the primary split and the home stack is the top visible task in // the secondary split, it means this is "minimized" and thus must prevent // overlapping with home. // TODO(b/158242495): get rid of this when drag/drop can use surface bounds. final ActivityStack rootSecondary = task.getDisplayArea().getRootSplitScreenSecondaryTask(); if (rootSecondary.isActivityTypeHome() || rootSecondary.isActivityTypeRecents()) { final WindowContainer topTask = rootSecondary.getTopChild(); if (topTask.isVisible()) { cutRect(mTmpRect, topTask.getBounds()); } } } } bounds.set(mWindowFrames.mVisibleFrame); Loading Loading
services/core/java/com/android/server/wm/Task.java +6 −1 Original line number Diff line number Diff line Loading @@ -2924,7 +2924,12 @@ class Task extends WindowContainer<WindowContainer> { } boolean cropWindowsToStackBounds() { return isResizeable(); // Don't crop HOME/RECENTS windows to stack bounds. This is because in split-screen // they extend past their stack and sysui uses the stack surface to control cropping. // TODO(b/158242495): get rid of this when drag/drop can use surface bounds. final boolean isTopHomeOrRecents = (isActivityTypeHome() || isActivityTypeRecents()) && getRootTask().getTopMostTask() == this; return isResizeable() && !isTopHomeOrRecents; } /** Loading
services/core/java/com/android/server/wm/TaskDisplayArea.java +9 −0 Original line number Diff line number Diff line Loading @@ -207,6 +207,15 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { return mRootSplitScreenPrimaryTask; } ActivityStack getRootSplitScreenSecondaryTask() { for (int i = mChildren.size() - 1; i >= 0; --i) { if (mChildren.get(i).inSplitScreenSecondaryWindowingMode()) { return mChildren.get(i); } } return null; } ArrayList<Task> getVisibleTasks() { final ArrayList<Task> visibleTasks = new ArrayList<>(); forAllTasks(task -> { Loading
services/core/java/com/android/server/wm/WindowState.java +37 −0 Original line number Diff line number Diff line Loading @@ -1528,6 +1528,29 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP && dc != null ? dc.getDefaultTaskDisplayArea().getRootHomeTask() : null; } /** * This is a form of rectangle "difference". It cut off each dimension of rect by the amount * that toRemove is "pushing into" it from the outside. Any dimension that fully contains * toRemove won't change. */ private void cutRect(Rect rect, Rect toRemove) { if (toRemove.isEmpty()) return; if (toRemove.top < rect.bottom && toRemove.bottom > rect.top) { if (toRemove.right >= rect.right && toRemove.left >= rect.left) { rect.right = toRemove.left; } else if (toRemove.left <= rect.left && toRemove.right <= rect.right) { rect.left = toRemove.right; } } if (toRemove.left < rect.right && toRemove.right > rect.left) { if (toRemove.bottom >= rect.bottom && toRemove.top >= rect.top) { rect.bottom = toRemove.top; } else if (toRemove.top <= rect.top && toRemove.bottom <= rect.bottom) { rect.top = toRemove.bottom; } } } /** * Retrieves the visible bounds of the window. * @param bounds The rect which gets the bounds. Loading @@ -1544,6 +1567,20 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } else { intersectWithStackBounds = false; } if (inSplitScreenPrimaryWindowingMode()) { // If this is in the primary split and the home stack is the top visible task in // the secondary split, it means this is "minimized" and thus must prevent // overlapping with home. // TODO(b/158242495): get rid of this when drag/drop can use surface bounds. final ActivityStack rootSecondary = task.getDisplayArea().getRootSplitScreenSecondaryTask(); if (rootSecondary.isActivityTypeHome() || rootSecondary.isActivityTypeRecents()) { final WindowContainer topTask = rootSecondary.getTopChild(); if (topTask.isVisible()) { cutRect(mTmpRect, topTask.getBounds()); } } } } bounds.set(mWindowFrames.mVisibleFrame); Loading