Fix issue with compressed smart replies.
Width overflows if we both remeasure due
to failing to squeeze and due to padding
changes.
Bug: 79225896
Test: atest SmartReplyViewTest
Test: manual - recieve notification from Inbox check reply buttons.
Change-Id: I8ef306bbb7e3732b433830f856257fbfedeb89c0
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
index 351868d..dbd9ddf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -454,12 +454,14 @@
// measured with the wrong number of lines).
if (child.getPaddingLeft() != buttonPaddingHorizontal) {
requiresNewMeasure = true;
- if (buttonPaddingHorizontal == mSingleLineButtonPaddingHorizontal) {
- // Decrease padding (2->1 line).
- newWidth -= mSingleToDoubleLineButtonWidthIncrease;
- } else {
- // Increase padding (1->2 lines).
- newWidth += mSingleToDoubleLineButtonWidthIncrease;
+ if (newWidth != Integer.MAX_VALUE) {
+ if (buttonPaddingHorizontal == mSingleLineButtonPaddingHorizontal) {
+ // Change padding (2->1 line).
+ newWidth -= mSingleToDoubleLineButtonWidthIncrease;
+ } else {
+ // Change padding (1->2 lines).
+ newWidth += mSingleToDoubleLineButtonWidthIncrease;
+ }
}
child.setPadding(buttonPaddingHorizontal, child.getPaddingTop(),
buttonPaddingHorizontal, child.getPaddingBottom());