Loading core/java/android/widget/flags/notification_widget_flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -57,3 +57,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "conversation_layout_use_maximum_child_height" namespace: "systemui" description: "MessagingChild always needs to be measured during MessagingLinearLayout onMeasure." bug: "324537506" metadata { purpose: PURPOSE_BUGFIX } } No newline at end of file core/java/com/android/internal/widget/ConversationLayout.java +34 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.widget; import static android.widget.flags.Flags.conversationLayoutUseMaximumChildHeight; import static com.android.internal.widget.MessagingGroup.IMAGE_DISPLAY_LOCATION_EXTERNAL; import static com.android.internal.widget.MessagingGroup.IMAGE_DISPLAY_LOCATION_INLINE; Loading Loading @@ -1407,6 +1409,38 @@ public class ConversationLayout extends FrameLayout } } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); // ConversationLayout needs to set its height to its biggest child to show the content // properly. // FrameLayout measures its match_parent children twice when any of FLs dimension is not // specified. However, its sets its own dimensions before the second measurement pass. // Content CutOff happens when children have bigger height on its second measurement. if (conversationLayoutUseMaximumChildHeight()) { int maxHeight = getMeasuredHeight(); final int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (child == null || child.getVisibility() == GONE) { continue; } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); maxHeight = Math.max(maxHeight, child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); } maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight()); if (maxHeight != getMeasuredHeight()) { setMeasuredDimension(getMeasuredWidth(), maxHeight); } } } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); Loading Loading
core/java/android/widget/flags/notification_widget_flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -57,3 +57,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "conversation_layout_use_maximum_child_height" namespace: "systemui" description: "MessagingChild always needs to be measured during MessagingLinearLayout onMeasure." bug: "324537506" metadata { purpose: PURPOSE_BUGFIX } } No newline at end of file
core/java/com/android/internal/widget/ConversationLayout.java +34 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.widget; import static android.widget.flags.Flags.conversationLayoutUseMaximumChildHeight; import static com.android.internal.widget.MessagingGroup.IMAGE_DISPLAY_LOCATION_EXTERNAL; import static com.android.internal.widget.MessagingGroup.IMAGE_DISPLAY_LOCATION_INLINE; Loading Loading @@ -1407,6 +1409,38 @@ public class ConversationLayout extends FrameLayout } } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); // ConversationLayout needs to set its height to its biggest child to show the content // properly. // FrameLayout measures its match_parent children twice when any of FLs dimension is not // specified. However, its sets its own dimensions before the second measurement pass. // Content CutOff happens when children have bigger height on its second measurement. if (conversationLayoutUseMaximumChildHeight()) { int maxHeight = getMeasuredHeight(); final int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (child == null || child.getVisibility() == GONE) { continue; } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); maxHeight = Math.max(maxHeight, child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); } maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight()); if (maxHeight != getMeasuredHeight()) { setMeasuredDimension(getMeasuredWidth(), maxHeight); } } } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); Loading