Merge "Add a reason the smart suggestion isn't shown to the layout params."
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 85add6c..7a664b0 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 @@
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 @@
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 @@
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 @@
}
lp.show = true;
+ lp.mNoShowReason = "n/a";
displayedChildCount++;
if (lp.mButtonType == SmartButtonType.ACTION) {
numShownActions++;
@@ -349,6 +359,7 @@
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 @@
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 @@
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
lp.show = false;
lp.squeezeStatus = LayoutParams.SQUEEZE_STATUS_NONE;
+ lp.mNoShowReason = "reset";
}
}
@@ -772,6 +786,7 @@
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);