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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user