Merge "Check lineHeight without cast" into udc-dev

This commit is contained in:
Treehugger Robot
2023-05-09 18:10:41 +00:00
committed by Android (Google) Code Review

View File

@@ -6228,7 +6228,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
private void setLineHeightPx(@Px @FloatRange(from = 0) float lineHeight) { private void setLineHeightPx(@Px @FloatRange(from = 0) float lineHeight) {
Preconditions.checkArgumentNonnegative((int) lineHeight); Preconditions.checkArgumentNonNegative(lineHeight,
"Expecting non-negative lineHeight while the input is " + lineHeight);
final int fontHeight = getPaint().getFontMetricsInt(null); final int fontHeight = getPaint().getFontMetricsInt(null);
// Make sure we don't setLineSpacing if it's not needed to avoid unnecessary redraw. // Make sure we don't setLineSpacing if it's not needed to avoid unnecessary redraw.