Suppress routine notification updates

This commit is contained in:
ajp_anton
2026-07-23 09:52:24 +00:00
parent 4b26f3369e
commit f698871e9a
4 changed files with 20 additions and 1 deletions
@@ -45,7 +45,8 @@ class NotificationCaptureService : NotificationListenerService() {
val previous = activeNotifications.put(snapshot.key, snapshot)
when {
previous == null -> record(snapshot, NotificationAction.APPEARED, LoggingType.APPEARING, includeContents = true)
previous.textContents != snapshot.textContents || previous.hasImage != snapshot.hasImage ->
(previous.textContents != snapshot.textContents || previous.hasImage != snapshot.hasImage) &&
!(snapshot.isRoutine && ruleStore.ruleFor(LoggingType.EDITS).ignoreRoutineUpdates) ->
record(snapshot, NotificationAction.EDITED, LoggingType.EDITS, includeContents = true)
}
}
@@ -9,6 +9,7 @@ data class NotificationSnapshot(
val packageName: String,
val textContents: String?,
val hasImage: Boolean,
val isRoutine: Boolean,
)
object NotificationContents {
@@ -36,6 +37,8 @@ object NotificationContents {
hasImage = sbn.notification.extras?.let {
it.containsKey(Notification.EXTRA_PICTURE) || it.containsKey(Notification.EXTRA_PICTURE_ICON)
} == true,
isRoutine = sbn.notification.extras?.getBoolean(Notification.EXTRA_SHOW_CHRONOMETER, false) == true ||
sbn.notification.extras?.containsKey(Notification.EXTRA_PROGRESS) == true,
)
private fun CharSequence.addTo(parts: MutableSet<String>) {