From 4c5aa51717b1858132ffc5c9804f409a161283ec Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Tue, 19 Apr 2016 11:29:05 -0700 Subject: [PATCH] Don't crop windows not on defualt display to stack bounds. There are some windows that live on other displays while there app and main window live on the default display (e.g. casting...). We don't want to crop this windows to the stack bounds which is only currently supported on the default display. Bug: 26782253 Change-Id: I45648cc6fe8729e35f5b28eb06207aac6c263cdf --- .../core/java/com/android/server/wm/WindowState.java | 3 +++ .../com/android/server/wm/WindowStateAnimator.java | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 5077f32938081..76fdda0175f0f 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2382,6 +2382,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { if (stack != null) { pw.print(" stackId="); pw.print(stack.mStackId); } + if (mNotOnAppsDisplay) { + pw.print(" mNotOnAppsDisplay="); pw.print(mNotOnAppsDisplay); + } pw.print(" mSession="); pw.print(mSession); pw.print(" mClient="); pw.println(mClient.asBinder()); pw.print(prefix); pw.print("mOwnerUid="); pw.print(mOwnerUid); diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 1f76f318b251a..08982f4466bca 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1290,6 +1290,17 @@ class WindowStateAnimator { } private void adjustCropToStackBounds(WindowState w, Rect clipRect, Rect finalClipRect, boolean isFreeformResizing) { + + final DisplayContent displayContent = w.getDisplayContent(); + if (displayContent != null && !displayContent.isDefaultDisplay) { + // There are some windows that live on other displays while their app and main window + // live on the default display (e.g. casting...). We don't want to crop this windows + // to the stack bounds which is only currently supported on the default display. + // TODO(multi-display): Need to support cropping to stack bounds on other displays + // when we have stacks on other displays. + return; + } + final Task task = w.getTask(); if (task == null || !task.cropWindowsToStackBounds()) { return;