CallStyle: don't reglue icon+label if never glued
EmphasizedNotificationButton has two ways of rendering the icon and
label:
1. Unglued, where they're set using View's standard methods.
2. Glued, where they're saved and combined into a single Spannable with
an ImageSpan for the icon.
A small logic error meant that we were "re-gluing" the icon and label on
layout direction updates *even if they weren't glued to start with*, and
gluing a null icon and label gives a blank button instead of the label
the caller already set.
Bug: 330746629
Test: atest NotificationEmphasizedButtonState
Flag: NA
Change-Id: I2160dd17d39bd00a045422e2096d14b9ebb68902
diff --git a/core/java/com/android/internal/widget/EmphasizedNotificationButton.java b/core/java/com/android/internal/widget/EmphasizedNotificationButton.java
index c07e624..65d5a1f 100644
--- a/core/java/com/android/internal/widget/EmphasizedNotificationButton.java
+++ b/core/java/com/android/internal/widget/EmphasizedNotificationButton.java
@@ -229,7 +229,8 @@
+ "gluedLayoutDirection = " + mGluedLayoutDirection);
}
- if (layoutDirection != mGluedLayoutDirection) {
+ final boolean alreadyGlued = mGluedLayoutDirection != LAYOUT_DIRECTION_UNDEFINED;
+ if (alreadyGlued && layoutDirection != mGluedLayoutDirection) {
if (DEBUG_NEW_ACTION_LAYOUT) {
Log.d(TAG, "onRtlPropertiesChanged: layout direction changed; regluing");
}