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

Commit 4d379cbf authored by Yunfan Chen's avatar Yunfan Chen
Browse files

Refine API of getting window visible display frame

The API of getWindowVisibleDisplayFrame() is using an estimated way to
calculate the frame when the view is not attached to a window. However,
the current estimation uses the navigation bar and display cutout as the
insets covering the view content, which is not consistent with the case
where the view is attached to a window.

Make the necessary change to let it consistent with the attached case.

Bug: 373497540
Test: PopupWindowTest
Flag: EXEMPT BUGFIX
Change-Id: I82df6b2da21bf186a296ce6ae8fffd4ffebb9f6f
parent 52f31f18
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -296,8 +296,8 @@ public class InsetsState implements Parcelable {
            @SoftInputModeFlags int softInputMode, int windowFlags) {
        final int softInputAdjustMode = softInputMode & SOFT_INPUT_MASK_ADJUST;
        final int visibleInsetsTypes = softInputAdjustMode != SOFT_INPUT_ADJUST_NOTHING
                ? systemBars() | ime()
                : systemBars();
                ? systemBars() | displayCutout() | ime()
                : systemBars() | displayCutout();
        @InsetsType int forceConsumingTypes = 0;
        Insets insets = Insets.NONE;
        for (int i = mSources.size() - 1; i >= 0; i--) {
+1 −1
Original line number Diff line number Diff line
@@ -17184,7 +17184,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        final WindowManager windowManager = mContext.getSystemService(WindowManager.class);
        final WindowMetrics metrics = windowManager.getMaximumWindowMetrics();
        final Insets insets = metrics.getWindowInsets().getInsets(
                WindowInsets.Type.navigationBars() | WindowInsets.Type.displayCutout());
                WindowInsets.Type.systemBars() | WindowInsets.Type.displayCutout());
        outRect.set(metrics.getBounds());
        outRect.inset(insets);
        outRect.offsetTo(0, 0);