Loading services/core/java/com/android/server/policy/WindowManagerPolicy.java +8 −0 Original line number Diff line number Diff line Loading @@ -396,6 +396,14 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { return false; } /** * Returns true if the window has a letterbox and any part of that letterbox overlaps with * the given {@code rect}. */ default boolean isLetterboxedOverlappingWith(Rect rect) { return false; } /** @return the current windowing mode of this window. */ int getWindowingMode(); Loading services/core/java/com/android/server/wm/ActivityRecord.java +4 −3 Original line number Diff line number Diff line Loading @@ -1395,10 +1395,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } /** * @see Letterbox#notIntersectsOrFullyContains(Rect) * @return {@code true} if there is a letterbox and any part of that letterbox overlaps with * the given {@code rect}. */ boolean letterboxNotIntersectsOrFullyContains(Rect rect) { return mLetterbox == null || mLetterbox.notIntersectsOrFullyContains(rect); boolean isLetterboxOverlappingWith(Rect rect) { return mLetterbox != null && mLetterbox.isOverlappingWith(rect); } static class Token extends IApplicationToken.Stub { Loading services/core/java/com/android/server/wm/BarController.java +1 −1 Original line number Diff line number Diff line Loading @@ -175,7 +175,7 @@ public class BarController { } final Rect rotatedContentFrame = win.mToken.getFixedRotationBarContentFrame(mWindowType); final Rect contentFrame = rotatedContentFrame != null ? rotatedContentFrame : mContentFrame; return win.letterboxNotIntersectsOrFullyContains(contentFrame); return !win.isLetterboxedOverlappingWith(contentFrame); } boolean setBarShowingLw(final boolean show) { Loading services/core/java/com/android/server/wm/Letterbox.java +20 −21 Original line number Diff line number Diff line Loading @@ -77,10 +77,10 @@ public class Letterbox { mOuter.set(outer); mInner.set(inner); mTop.layout(outer.left, outer.top, outer.right, inner.top, surfaceOrigin); mLeft.layout(outer.left, outer.top, inner.left, outer.bottom, surfaceOrigin); mBottom.layout(outer.left, inner.bottom, outer.right, outer.bottom, surfaceOrigin); mRight.layout(inner.right, outer.top, outer.right, outer.bottom, surfaceOrigin); mTop.layout(outer.left, outer.top, inner.right, inner.top, surfaceOrigin); mLeft.layout(outer.left, inner.top, inner.left, outer.bottom, surfaceOrigin); mBottom.layout(inner.left, inner.bottom, outer.right, outer.bottom, surfaceOrigin); mRight.layout(inner.right, outer.top, outer.right, inner.bottom, surfaceOrigin); } Loading @@ -101,29 +101,17 @@ public class Letterbox { } /** * Returns {@code true} if the letterbox does not overlap with the bar, or the letterbox can * fully cover the window frame. * * @param rect The area of the window frame. * Returns true if any part of the letterbox overlaps with the given {@code rect}. */ boolean notIntersectsOrFullyContains(Rect rect) { int emptyCount = 0; int noOverlappingCount = 0; public boolean isOverlappingWith(Rect rect) { for (LetterboxSurface surface : mSurfaces) { final Rect surfaceRect = surface.mLayoutFrameGlobal; if (surfaceRect.isEmpty()) { // empty letterbox emptyCount++; } else if (!Rect.intersects(surfaceRect, rect)) { // no overlapping noOverlappingCount++; } else if (surfaceRect.contains(rect)) { // overlapping and covered if (surface.isOverlappingWith(rect)) { return true; } } return (emptyCount + noOverlappingCount) == mSurfaces.length; return false; } /** * Hides the letterbox. * Loading Loading @@ -298,6 +286,17 @@ public class Letterbox { return Math.max(0, mLayoutFrameGlobal.height()); } /** * Returns if the given {@code rect} overlaps with this letterbox piece. * @param rect the area to check for overlap in global coordinates */ public boolean isOverlappingWith(Rect rect) { if (mLayoutFrameGlobal.isEmpty()) { return false; } return Rect.intersects(rect, mLayoutFrameGlobal); } public void applySurfaceChanges(SurfaceControl.Transaction t) { if (mSurfaceFrameRelative.equals(mLayoutFrameRelative)) { // Nothing changed. Loading services/core/java/com/android/server/wm/WindowState.java +3 −6 Original line number Diff line number Diff line Loading @@ -3797,12 +3797,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mActivityRecord.getBounds().equals(mTmpRect); } /** * @see Letterbox#notIntersectsOrFullyContains(Rect) */ boolean letterboxNotIntersectsOrFullyContains(Rect rect) { return mActivityRecord == null || mActivityRecord.letterboxNotIntersectsOrFullyContains(rect); @Override public boolean isLetterboxedOverlappingWith(Rect rect) { return mActivityRecord != null && mActivityRecord.isLetterboxOverlappingWith(rect); } boolean isDragResizeChanged() { Loading Loading
services/core/java/com/android/server/policy/WindowManagerPolicy.java +8 −0 Original line number Diff line number Diff line Loading @@ -396,6 +396,14 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { return false; } /** * Returns true if the window has a letterbox and any part of that letterbox overlaps with * the given {@code rect}. */ default boolean isLetterboxedOverlappingWith(Rect rect) { return false; } /** @return the current windowing mode of this window. */ int getWindowingMode(); Loading
services/core/java/com/android/server/wm/ActivityRecord.java +4 −3 Original line number Diff line number Diff line Loading @@ -1395,10 +1395,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } /** * @see Letterbox#notIntersectsOrFullyContains(Rect) * @return {@code true} if there is a letterbox and any part of that letterbox overlaps with * the given {@code rect}. */ boolean letterboxNotIntersectsOrFullyContains(Rect rect) { return mLetterbox == null || mLetterbox.notIntersectsOrFullyContains(rect); boolean isLetterboxOverlappingWith(Rect rect) { return mLetterbox != null && mLetterbox.isOverlappingWith(rect); } static class Token extends IApplicationToken.Stub { Loading
services/core/java/com/android/server/wm/BarController.java +1 −1 Original line number Diff line number Diff line Loading @@ -175,7 +175,7 @@ public class BarController { } final Rect rotatedContentFrame = win.mToken.getFixedRotationBarContentFrame(mWindowType); final Rect contentFrame = rotatedContentFrame != null ? rotatedContentFrame : mContentFrame; return win.letterboxNotIntersectsOrFullyContains(contentFrame); return !win.isLetterboxedOverlappingWith(contentFrame); } boolean setBarShowingLw(final boolean show) { Loading
services/core/java/com/android/server/wm/Letterbox.java +20 −21 Original line number Diff line number Diff line Loading @@ -77,10 +77,10 @@ public class Letterbox { mOuter.set(outer); mInner.set(inner); mTop.layout(outer.left, outer.top, outer.right, inner.top, surfaceOrigin); mLeft.layout(outer.left, outer.top, inner.left, outer.bottom, surfaceOrigin); mBottom.layout(outer.left, inner.bottom, outer.right, outer.bottom, surfaceOrigin); mRight.layout(inner.right, outer.top, outer.right, outer.bottom, surfaceOrigin); mTop.layout(outer.left, outer.top, inner.right, inner.top, surfaceOrigin); mLeft.layout(outer.left, inner.top, inner.left, outer.bottom, surfaceOrigin); mBottom.layout(inner.left, inner.bottom, outer.right, outer.bottom, surfaceOrigin); mRight.layout(inner.right, outer.top, outer.right, inner.bottom, surfaceOrigin); } Loading @@ -101,29 +101,17 @@ public class Letterbox { } /** * Returns {@code true} if the letterbox does not overlap with the bar, or the letterbox can * fully cover the window frame. * * @param rect The area of the window frame. * Returns true if any part of the letterbox overlaps with the given {@code rect}. */ boolean notIntersectsOrFullyContains(Rect rect) { int emptyCount = 0; int noOverlappingCount = 0; public boolean isOverlappingWith(Rect rect) { for (LetterboxSurface surface : mSurfaces) { final Rect surfaceRect = surface.mLayoutFrameGlobal; if (surfaceRect.isEmpty()) { // empty letterbox emptyCount++; } else if (!Rect.intersects(surfaceRect, rect)) { // no overlapping noOverlappingCount++; } else if (surfaceRect.contains(rect)) { // overlapping and covered if (surface.isOverlappingWith(rect)) { return true; } } return (emptyCount + noOverlappingCount) == mSurfaces.length; return false; } /** * Hides the letterbox. * Loading Loading @@ -298,6 +286,17 @@ public class Letterbox { return Math.max(0, mLayoutFrameGlobal.height()); } /** * Returns if the given {@code rect} overlaps with this letterbox piece. * @param rect the area to check for overlap in global coordinates */ public boolean isOverlappingWith(Rect rect) { if (mLayoutFrameGlobal.isEmpty()) { return false; } return Rect.intersects(rect, mLayoutFrameGlobal); } public void applySurfaceChanges(SurfaceControl.Transaction t) { if (mSurfaceFrameRelative.equals(mLayoutFrameRelative)) { // Nothing changed. Loading
services/core/java/com/android/server/wm/WindowState.java +3 −6 Original line number Diff line number Diff line Loading @@ -3797,12 +3797,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mActivityRecord.getBounds().equals(mTmpRect); } /** * @see Letterbox#notIntersectsOrFullyContains(Rect) */ boolean letterboxNotIntersectsOrFullyContains(Rect rect) { return mActivityRecord == null || mActivityRecord.letterboxNotIntersectsOrFullyContains(rect); @Override public boolean isLetterboxedOverlappingWith(Rect rect) { return mActivityRecord != null && mActivityRecord.isLetterboxOverlappingWith(rect); } boolean isDragResizeChanged() { Loading