diff options
| author | 2022-03-03 01:08:29 +0000 | |
|---|---|---|
| committer | 2022-03-10 03:38:38 +0000 | |
| commit | 899562852d774021af21c96fffc1a6ea8a93f093 (patch) | |
| tree | 378b89dbde7f839264e48ac17b3e0be378efa9c5 | |
| parent | 883d3e645dd352afb4e1a4319873175bb1456a98 (diff) | |
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
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java index b52c8d118711..ab00ed00000f 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java @@ -515,7 +515,9 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange } 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; return (int) (minWidth / density); } |