Suppress routine notification updates
This commit is contained in:
@@ -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>) {
|
||||
|
||||
Reference in New Issue
Block a user