summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jerry Chang <chenghsiuchang@google.com> 2022-03-03 01:08:29 +0000
committer Jerry Chang <chenghsiuchang@google.com> 2022-03-10 03:38:38 +0000
commit899562852d774021af21c96fffc1a6ea8a93f093 (patch)
tree378b89dbde7f839264e48ac17b3e0be378efa9c5
parent883d3e645dd352afb4e1a4319873175bb1456a98 (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.java4
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);
}