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

Commit 89956285 authored by Jerry Chang's avatar Jerry Chang
Browse files

Consider screen insets when setting smallestWidthDp

Take system bars and display cutout insets into account when calculating
smallestWidthDp for splitting tasks.

Bug: 217600744
Test: atest WMShellUnitTests
Change-Id: Ifa56c51d90418d9771d95bd64be69b2c084e446f
parent 883d3e64
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -515,7 +515,9 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
    }
    }


    private int getSmallestWidthDp(Rect bounds) {
    private int getSmallestWidthDp(Rect bounds) {
        final int minWidth = Math.min(bounds.width(), bounds.height());
        mTempRect.set(bounds);
        mTempRect.inset(getDisplayInsets(mContext));
        final int minWidth = Math.min(mTempRect.width(), mTempRect.height());
        final float density = mContext.getResources().getDisplayMetrics().density;
        final float density = mContext.getResources().getDisplayMetrics().density;
        return (int) (minWidth / density);
        return (int) (minWidth / density);
    }
    }