From 9635b646d877d6315a03487eae7bd62999e0af8d Mon Sep 17 00:00:00 2001 From: Taesu Lee Date: Fri, 8 May 2020 17:42:27 +0900 Subject: [PATCH] Fix NPE on MultiConversationNotificationState Use the most recent notification's state to print out log because mContent is null in case of a notification for multiple messages in at least 2 different conversations. And no need sanitizePII() since this log is only for VERBOSE already. Test: 1) adb shell setprop log.tag.MessagingAppNotif VERBOSE 2) Receive SMS from different senders Signed-off-by: Taesu Lee Change-Id: Ie300620f0014577ca65b9a7e3a4c397a39717992 --- .../datamodel/MessageNotificationState.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/com/android/messaging/datamodel/MessageNotificationState.java b/src/com/android/messaging/datamodel/MessageNotificationState.java index 68d8538..f0e8364 100644 --- a/src/com/android/messaging/datamodel/MessageNotificationState.java +++ b/src/com/android/messaging/datamodel/MessageNotificationState.java @@ -100,7 +100,6 @@ public abstract class MessageNotificationState extends NotificationState { protected CharSequence mContent = null; protected Uri mAttachmentUri = null; protected String mAttachmentType = null; - protected boolean mTickerNoContent; @Override protected Uri getAttachmentUri() { @@ -1088,8 +1087,10 @@ public abstract class MessageNotificationState extends NotificationState { } if (state != null && LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { LogUtil.v(TAG, "MessageNotificationState: Notification state created" - + ", title = " + LogUtil.sanitizePII(state.mTitle) - + ", content = " + LogUtil.sanitizePII(state.mContent.toString())); + + ", title = " + + (state.mTickerSender != null ? state.mTickerSender : state.mTitle) + + ", content = " + + (state.mTickerText != null ? state.mTickerText : state.mContent)); } return state; } @@ -1129,8 +1130,9 @@ public abstract class MessageNotificationState extends NotificationState { protected CharSequence getTicker() { return BugleNotifications.buildColonSeparatedMessage( mTickerSender != null ? mTickerSender : mTitle, - mTickerText != null ? mTickerText : (mTickerNoContent ? null : mContent), null, - null); + mTickerText != null ? mTickerText : mContent, + null, + null); } private static CharSequence convertHtmlAndStripUrls(final String s) {