diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-09-21 23:07:54 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-09-21 23:07:54 +0000 |
commit | 33c163478947461cdd469bbbd7ded48c865b810c (patch) | |
tree | 1153f5f437f3c8454733c2fc7d581ddf12ed1b07 | |
parent | 98f349ea22c44eb1f34041a345724d216a538c5b (diff) | |
parent | c7420e9c97b111ddc4dea956c76ec3fad2f2b47e (diff) | |
download | Messenger-android11-qpr1-release.tar.gz |
Snap for 6852881 from c7420e9c97b111ddc4dea956c76ec3fad2f2b47e to rvc-qpr1-releaseandroid-11.0.0_r31android-11.0.0_r29android-11.0.0_r28android-11.0.0_r27android-11.0.0_r26android-11.0.0_r24android-11.0.0_r23android-11.0.0_r22android-11.0.0_r21android-11.0.0_r20android-11.0.0_r19android-11.0.0_r18android11-qpr1-s2-releaseandroid11-qpr1-s1-releaseandroid11-qpr1-releaseandroid11-qpr1-d-s1-releaseandroid11-qpr1-d-release
Change-Id: I1b9f35041d3752ddaca5441185104d252b1aa879
-rw-r--r-- | src/com/android/car/messenger/MessageNotificationDelegate.java | 14 |
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, |