diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/util/cm/SpamFilter.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/core/java/com/android/internal/util/cm/SpamFilter.java b/core/java/com/android/internal/util/cm/SpamFilter.java index 9de4489..c261009 100644 --- a/core/java/com/android/internal/util/cm/SpamFilter.java +++ b/core/java/com/android/internal/util/cm/SpamFilter.java @@ -46,10 +46,21 @@ public class SpamFilter { } public static String getNotificationContent(Notification notification) { + CharSequence notificationTitle = getNotificationTitle(notification); + CharSequence notificationMessage = getNotificationMessage(notification); + return notificationTitle + "\n" + notificationMessage; + } + + private static CharSequence getNotificationTitle(Notification notification) { Bundle extras = notification.extras; String titleExtra = extras.containsKey(Notification.EXTRA_TITLE_BIG) ? Notification.EXTRA_TITLE_BIG : Notification.EXTRA_TITLE; CharSequence notificationTitle = extras.getCharSequence(titleExtra); + return notificationTitle; + } + + private static CharSequence getNotificationMessage(Notification notification) { + Bundle extras = notification.extras; CharSequence notificationMessage = extras.getCharSequence(Notification.EXTRA_TEXT); if (TextUtils.isEmpty(notificationMessage)) { @@ -60,6 +71,12 @@ public class SpamFilter { notificationMessage = TextUtils.join("\n", inboxLines); } } - return notificationTitle + "\n" + notificationMessage; + return notificationMessage; + } + + public static boolean hasFilterableContent(Notification notification) { + CharSequence notificationTitle = getNotificationTitle(notification); + CharSequence notificationMessage = getNotificationMessage(notification); + return !(TextUtils.isEmpty(notificationTitle) && TextUtils.isEmpty(notificationMessage)); } } |