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

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

Use stable rect to determine if we should adjust for IME in split-screen

Regression was introduced in ag/3174240 where the content rect used to
be cached before the layout IME so the IME didn't affect the content
rect. However, we don't want content rect to mean something differect
here as content rect excludes the IME space in the rest of the system.
So, changed the one use case we have for this to use stable rect.

Change-Id: I13e23baf87dbcaf21a8e0624f73b9af6116f7262
Fixes: 69425766
Test: Steps from bug
parent 95b897aa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1766,8 +1766,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        updateBounds();
    }

    void getContentRect(Rect out) {
        out.set(mDisplayFrames.mContent);
    void getStableRect(Rect out) {
        out.set(mDisplayFrames.mStable);
    }

    TaskStack createStack(int stackId, boolean onTop, StackWindowController controller) {
+6 −6
Original line number Diff line number Diff line
@@ -1114,12 +1114,12 @@ public class TaskStack extends WindowContainer<Task> implements
            return false;
        }

        final Rect displayContentRect = mTmpRect;
        final Rect displayStableRect = mTmpRect;
        final Rect contentBounds = mTmpRect2;

        // Calculate the content bounds excluding the area occupied by IME
        getDisplayContent().getContentRect(displayContentRect);
        contentBounds.set(displayContentRect);
        getDisplayContent().getStableRect(displayStableRect);
        contentBounds.set(displayStableRect);
        int imeTop = Math.max(imeWin.getFrameLw().top, contentBounds.top);

        imeTop += imeWin.getGivenContentInsetsLw().top;
@@ -1127,7 +1127,7 @@ public class TaskStack extends WindowContainer<Task> implements
            contentBounds.bottom = imeTop;
        }

        final int yOffset = displayContentRect.bottom - contentBounds.bottom;
        final int yOffset = displayStableRect.bottom - contentBounds.bottom;

        final int dividerWidth =
                getDisplayContent().mDividerControllerLocked.getContentWidth();
@@ -1139,7 +1139,7 @@ public class TaskStack extends WindowContainer<Task> implements
            // occluded by IME. We shift its bottom up by the height of the IME, but
            // leaves at least 30% of the top stack visible.
            final int minTopStackBottom =
                    getMinTopStackBottom(displayContentRect, getRawBounds().bottom);
                    getMinTopStackBottom(displayStableRect, getRawBounds().bottom);
            final int bottom = Math.max(
                    getRawBounds().bottom - yOffset + dividerWidth - dividerWidthInactive,
                    minTopStackBottom);
@@ -1159,7 +1159,7 @@ public class TaskStack extends WindowContainer<Task> implements
            final int topBeforeImeAdjust =
                    getRawBounds().top - dividerWidth + dividerWidthInactive;
            final int minTopStackBottom =
                    getMinTopStackBottom(displayContentRect,
                    getMinTopStackBottom(displayStableRect,
                            getRawBounds().top - dividerWidth);
            final int top = Math.max(
                    getRawBounds().top - yOffset, minTopStackBottom + dividerWidthInactive);