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

Commit fd366002 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Use size compat bounds for window layout" into sc-v2-dev am: eced4b32 am: a5fec406

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

Change-Id: Ice57b134de3bd0ed8a910ba76978b938511fc502
parents 3c596e39 a5fec406
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1442,6 +1442,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }
    }

    @Override
    public Rect getBounds() {
        // The window bounds are used for layout in screen coordinates. If the token has bounds for
        // size compatibility mode, its configuration bounds are app based coordinates which should
        // not be used for layout.
        return mToken.hasSizeCompatBounds() ? mToken.getBounds() : super.getBounds();
    }

    /** Retrieves the current frame of the window that the application sees. */
    Rect getFrame() {
        return mWindowFrames.mFrame;
+5 −0
Original line number Diff line number Diff line
@@ -320,6 +320,11 @@ public class SizeCompatTests extends WindowTestsBase {
        assertScaled();
        // Activity is sandboxed due to size compat mode.
        assertActivityMaxBoundsSandboxed();

        final WindowState appWindow = addWindowToActivity(mActivity);
        assertTrue(mActivity.hasSizeCompatBounds());
        assertEquals("App window must use size compat bounds for layout in screen space",
                mActivity.getBounds(), appWindow.getBounds());
    }

    @Test