summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-09-21 23:07:54 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-09-21 23:07:54 +0000
commit33c163478947461cdd469bbbd7ded48c865b810c (patch)
tree1153f5f437f3c8454733c2fc7d581ddf12ed1b07
parent98f349ea22c44eb1f34041a345724d216a538c5b (diff)
parentc7420e9c97b111ddc4dea956c76ec3fad2f2b47e (diff)
downloadMessenger-android11-qpr1-release.tar.gz
Change-Id: I1b9f35041d3752ddaca5441185104d252b1aa879
-rw-r--r--src/com/android/car/messenger/MessageNotificationDelegate.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/car/messenger/MessageNotificationDelegate.java b/src/com/android/car/messenger/MessageNotificationDelegate.java
index 8541c5d..5fa6db0 100644
--- a/src/com/android/car/messenger/MessageNotificationDelegate.java
+++ b/src/com/android/car/messenger/MessageNotificationDelegate.java
@@ -59,6 +59,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
@@ -75,6 +76,7 @@ public class MessageNotificationDelegate extends BaseNotificationDelegate implem
/** Tracks whether a projection application is active in the foreground. **/
private ProjectionStateListener mProjectionStateListener;
private CompletableFuture<Void> mPhoneNumberInfoFuture;
+ private Locale mGeneratedGroupConversationTitlesLocale;
private static int mBitmapSize;
private static float mCornerRadiusPercent;
private static boolean mShouldLoadExistingMessages;
@@ -396,6 +398,13 @@ public class MessageNotificationDelegate extends BaseNotificationDelegate implem
*/
private void setGroupConversationTitle(ConversationKey conversationKey) {
ConversationNotificationInfo notificationInfo = mNotificationInfos.get(conversationKey);
+ Locale locale = Locale.getDefault();
+
+ // Do not reuse the old titles if locale has changed. The new locale might need different
+ // formatting or text direction.
+ if (locale != mGeneratedGroupConversationTitlesLocale) {
+ mGeneratedGroupConversationTitles.clear();
+ }
if (!notificationInfo.isGroupConvo()
|| mGeneratedGroupConversationTitles.contains(conversationKey)) {
return;
@@ -416,7 +425,10 @@ public class MessageNotificationDelegate extends BaseNotificationDelegate implem
notificationInfo.setConvoTitle(Utils.constructGroupConversationTitle(names,
mContext.getString(R.string.name_separator), mNotificationConversationTitleLength));
- if (allNamesLoaded) mGeneratedGroupConversationTitles.add(conversationKey);
+ if (allNamesLoaded) {
+ mGeneratedGroupConversationTitlesLocale = locale;
+ mGeneratedGroupConversationTitles.add(conversationKey);
+ }
}
private void loadPhoneNumberInfo(@Nullable String phoneNumber,