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

Commit 701d7308 authored by Robert Carr's avatar Robert Carr
Browse files

PopupWindow: Don't ignore top decorations in getMaxAvailableHeight.

getMaxAvailableHeight is ignoring the top insets, while
findDropDownPosition is not. This is causing getMaxAvailableHeight
to return a fits above position that findDropDownPosition will think
is too large.

Bug: 31048766
Change-Id: Ifa57cb4ebe0944c701a6f38b58d4f144d8b9199c
parent 735b9eca
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1758,11 +1758,22 @@ public class PopupWindow {
     */
    public int getMaxAvailableHeight(
            @NonNull View anchor, int yOffset, boolean ignoreBottomDecorations) {
        final Rect displayFrame = new Rect();
        Rect displayFrame = null;
        final Rect visibleDisplayFrame = new Rect();

        anchor.getWindowVisibleDisplayFrame(visibleDisplayFrame);
        if (ignoreBottomDecorations) {
            // In the ignore bottom decorations case we want to
            // still respect all other decorations so we use the inset visible
            // frame on the top right and left and take the bottom
            // value from the full frame.
            displayFrame = new Rect();
            anchor.getWindowDisplayFrame(displayFrame);
            displayFrame.top = visibleDisplayFrame.top;
            displayFrame.right = visibleDisplayFrame.right;
            displayFrame.left = visibleDisplayFrame.left;
        } else {
            anchor.getWindowVisibleDisplayFrame(displayFrame);
            displayFrame = visibleDisplayFrame;
        }

        final int[] anchorPos = mTmpDrawingLocation;