Merge "Consider screen insets when setting smallestWidthDp" into tm-dev

This commit is contained in:
Jerry Chang
2022-03-16 02:05:17 +00:00
committed by Android (Google) Code Review

View File

@@ -532,7 +532,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);
}