summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Priyanka Advani <padvani@google.com> 2024-03-20 21:54:25 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-03-20 21:54:25 +0000
commitbe7a60f1945a54d17e93c70b96513d0e4942756d (patch)
treec6c6c8e2c96ea91930438bc25386fd6c49df4654
parent614da108d8e4259ad925a437830408e83b6c3979 (diff)
Revert "CallStyle: Also handle null label to glue"
This reverts commit 614da108d8e4259ad925a437830408e83b6c3979. Reason for revert: Droid-monitor created revert due to test breakages in b/330590608. Will be verifying through ABTD for confirmation and before submitting the revert. Change-Id: I978863e433869ad152f41e3c303a1ff9c5745cce
-rw-r--r--core/java/com/android/internal/widget/EmphasizedNotificationButton.java35
1 files changed, 20 insertions, 15 deletions
diff --git a/core/java/com/android/internal/widget/EmphasizedNotificationButton.java b/core/java/com/android/internal/widget/EmphasizedNotificationButton.java
index 56b93b3a046f..c07e62414ac2 100644
--- a/core/java/com/android/internal/widget/EmphasizedNotificationButton.java
+++ b/core/java/com/android/internal/widget/EmphasizedNotificationButton.java
@@ -249,6 +249,14 @@ public class EmphasizedNotificationButton extends Button {
return;
}
+ if (mIconToGlue == null && mLabelToGlue == null) {
+ if (DEBUG_NEW_ACTION_LAYOUT) {
+ Log.v(TAG, "glueIconAndLabelIfNeeded: no icon or label to glue; doing nothing");
+ }
+ mGluePending = false;
+ return;
+ }
+
if (!evenlyDividedCallStyleActionLayout()) {
Log.e(TAG, "glueIconAndLabelIfNeeded: new action layout disabled; doing nothing");
return;
@@ -264,6 +272,17 @@ public class EmphasizedNotificationButton extends Button {
return;
}
+ // Ready to glue but don't have an icon *and* a label:
+ //
+ // (Note that this will *not* happen while the button is being initialized, since we won't
+ // be ready to glue. This can only happen if the button is initialized and displayed and
+ // *then* someone calls glueIcon or glueLabel.
+
+ if (mLabelToGlue == null) {
+ Log.w(TAG, "glueIconAndLabelIfNeeded: icon glued without label; doing nothing");
+ return;
+ }
+
// Can't glue:
final int layoutDirection = getLayoutDirection();
@@ -294,26 +313,12 @@ public class EmphasizedNotificationButton extends Button {
private static final String POP_DIRECTIONAL_ISOLATE = "\u2069";
private void glueIconAndLabel(int layoutDirection) {
- if (mIconToGlue == null && mLabelToGlue == null) {
- if (DEBUG_NEW_ACTION_LAYOUT) {
- Log.d(TAG, "glueIconAndLabel: null icon and label, setting text to empty string");
- }
- setText("");
- return;
- } else if (mIconToGlue == null) {
+ if (mIconToGlue == null) {
if (DEBUG_NEW_ACTION_LAYOUT) {
Log.d(TAG, "glueIconAndLabel: null icon, setting text to label");
}
setText(mLabelToGlue);
return;
- } else if (mLabelToGlue == null) {
- if (DEBUG_NEW_ACTION_LAYOUT) {
- Log.d(TAG, "glueIconAndLabel: null label, setting text to ImageSpan with icon");
- }
- final SpannableStringBuilder builder = new SpannableStringBuilder();
- appendSpan(builder, IMAGE_SPAN_TEXT, new ImageSpan(mIconToGlue, ALIGN_CENTER));
- setText(builder);
- return;
}
final boolean rtlLayout = layoutDirection == LAYOUT_DIRECTION_RTL;