From 368fcb27b71991bf69ebae288987d3d917da5f56 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Sat, 27 Nov 2021 14:24:25 +0000 Subject: [PATCH] Add a reason the smart suggestion isn't shown to the layout params. Bug: 205657774 Test: dumpsysui StatusBarGoogle Change-Id: I2a979b76f377b23d79ad6944dda07842ea604de3 --- .../statusbar/policy/SmartReplyView.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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 85add6c21b72d..7a664b01a70ae 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java @@ -264,6 +264,7 @@ public class SmartReplyView extends ViewGroup { if (maxNumActions != -1 // -1 means 'no limit' && lp.mButtonType == SmartButtonType.ACTION && numShownActions >= maxNumActions) { + lp.mNoShowReason = "max-actions-shown"; // We've reached the maximum number of actions, don't add another one! continue; } @@ -274,8 +275,15 @@ public class SmartReplyView extends ViewGroup { coveredSuggestions.add(child); final int lineCount = ((Button) child).getLineCount(); - if (lineCount < 1 || lineCount > 2) { - // If smart reply has no text, or more than two lines, then don't show it. + if (lineCount < 1) { + // If smart reply has no text, then don't show it. + lp.mNoShowReason = "line-count-0"; + continue; + + } + if (lineCount > 2) { + // If smart reply has more than two lines, then don't show it. + lp.mNoShowReason = "line-count-3+"; continue; } @@ -324,6 +332,7 @@ public class SmartReplyView extends ViewGroup { markButtonsWithPendingSqueezeStatusAs( LayoutParams.SQUEEZE_STATUS_FAILED, coveredSuggestions); + lp.mNoShowReason = "overflow"; // The current button doesn't fit, keep on adding lower-priority buttons in case // any of those fit. continue; @@ -336,6 +345,7 @@ public class SmartReplyView extends ViewGroup { } lp.show = true; + lp.mNoShowReason = "n/a"; displayedChildCount++; if (lp.mButtonType == SmartButtonType.ACTION) { numShownActions++; @@ -349,6 +359,7 @@ public class SmartReplyView extends ViewGroup { for (View smartReplyButton : smartReplies) { final LayoutParams lp = (LayoutParams) smartReplyButton.getLayoutParams(); lp.show = false; + lp.mNoShowReason = "not-enough-system-replies"; } // Reset our measures back to when we had only added actions (before adding // replies). @@ -427,6 +438,8 @@ public class SmartReplyView extends ViewGroup { pw.print(lp.squeezeStatus); pw.print(" show="); pw.print(lp.show); + pw.print(" noShowReason="); + pw.print(lp.mNoShowReason); pw.print(" view="); pw.println(child); } @@ -498,6 +511,7 @@ public class SmartReplyView extends ViewGroup { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); lp.show = false; lp.squeezeStatus = LayoutParams.SQUEEZE_STATUS_NONE; + lp.mNoShowReason = "reset"; } } @@ -772,6 +786,7 @@ public class SmartReplyView extends ViewGroup { private boolean show = false; private int squeezeStatus = SQUEEZE_STATUS_NONE; SmartButtonType mButtonType = SmartButtonType.REPLY; + String mNoShowReason = "new"; private LayoutParams(Context c, AttributeSet attrs) { super(c, attrs);