Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6243ab0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revert "Allow bar to be transparent if letterbox contains bar"" into...

Merge "Revert "Allow bar to be transparent if letterbox contains bar"" into rvc-dev am: 64682e76 am: 6ddc9881

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12128053

Change-Id: I8a3765defef2007553f09bc6ac3b806231ee7c8f
parents 8bfe6aa3 6ddc9881
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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();

+4 −3
Original line number Diff line number Diff line
@@ -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 {
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+20 −21
Original line number Diff line number Diff line
@@ -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);
    }


@@ -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.
     *
@@ -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.
+3 −6
Original line number Diff line number Diff line
@@ -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