diff --git a/CHANGELOG.md b/CHANGELOG.md index e5caacc23..18c768962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ * Zepp OS: Fix reminder creation * Bump target SDK version to 31 * Fix media button control for some applications +* Fix notification filters by title if notification does not contain a body * Fix opening screenshots from notification on external apps * Fix reconnect delay reset after all devices are initialized * Fix transliteration of emoji diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java index 6760869c9..93df781fc 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java @@ -96,6 +96,7 @@ import java.util.concurrent.TimeUnit; import static nodomain.freeyourgadget.gadgetbridge.activities.NotificationFilterActivity.NOTIFICATION_FILTER_MODE_BLACKLIST; import static nodomain.freeyourgadget.gadgetbridge.activities.NotificationFilterActivity.NOTIFICATION_FILTER_MODE_WHITELIST; import static nodomain.freeyourgadget.gadgetbridge.activities.NotificationFilterActivity.NOTIFICATION_FILTER_SUBMODE_ALL; +import static nodomain.freeyourgadget.gadgetbridge.util.StringUtils.ensureNotNull; public class NotificationListener extends NotificationListenerService { @@ -387,8 +388,9 @@ public class NotificationListener extends NotificationListenerService { dissectNotificationTo(notification, notificationSpec, preferBigText); - if (notificationSpec.body != null) { - if (!checkNotificationContentForWhiteAndBlackList(sbn.getPackageName().toLowerCase(), notificationSpec.title + " " + notificationSpec.body)) { + if (notificationSpec.title != null || notificationSpec.body != null) { + final String textToCheck = ensureNotNull(notificationSpec.title) + " " + ensureNotNull(notificationSpec.body); + if (!checkNotificationContentForWhiteAndBlackList(sbn.getPackageName().toLowerCase(), textToCheck)) { return; } }