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

Commit 94596654 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Limit window display frame to size of containing stack

Some widgets like the PopupWindow use the display frame from
WindowManager to figure-out where to place content. We want to
limit the size of the display frame to the containing stack in
a multi-window environment so widgets and apps don't place
contents outside the containing stack of the window.

Bug: 19225079
Bug: 19286146
Change-Id: I58e2db47f6696260d7641cf5d588c4f2db6aff5a
parent 7869f4c9
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -232,7 +232,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {

    final Rect mParentFrame = new Rect();

    // The entire screen area of the device.
    // The entire screen area of the {@link TaskStack} this window is in. Usually equal to the
    // screen area of the device.
    final Rect mDisplayFrame = new Rect();

    // The region of the display frame that the display type supports displaying content on. This
@@ -509,11 +510,11 @@ final class WindowState implements WindowManagerPolicy.WindowState {
            if (stack.mUnderStatusBar) {
                mContainingFrame.top = pf.top;
            }
            mDisplayFrame.set(mContainingFrame);
        } else {
            mContainingFrame.set(pf);
        }

            mDisplayFrame.set(df);
        }

        final int pw = mContainingFrame.width();
        final int ph = mContainingFrame.height();
@@ -572,9 +573,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        final int fw = mFrame.width();
        final int fh = mFrame.height();

        //System.out.println("In: w=" + w + " h=" + h + " container=" +
        //                   container + " x=" + mAttrs.x + " y=" + mAttrs.y);

        float x, y;
        if (mEnforceSizeCompat) {
            x = mAttrs.x * mGlobalScale;
@@ -591,8 +589,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
                (int) (x + mAttrs.horizontalMargin * pw),
                (int) (y + mAttrs.verticalMargin * ph), mFrame);

        // Now make sure the window fits in the overall display.
        Gravity.applyDisplay(mAttrs.gravity, df, mFrame);
        // Now make sure the window fits in the overall display frame.
        Gravity.applyDisplay(mAttrs.gravity, mDisplayFrame, mFrame);

        // Make sure the content and visible frames are inside of the
        // final window frame.