Filter group summary cancellation logs

This commit is contained in:
ajp_anton
2026-07-27 22:08:25 +00:00
parent 6116c13e00
commit 6a41b922e3
3 changed files with 30 additions and 2 deletions
@@ -1,7 +1,17 @@
package se.ajpanton.notificationlog.capture
import se.ajpanton.notificationlog.model.NotificationAction
/** Applies the global, Android-provided group-summary classification without inspecting text. */
object GroupSummaryPolicy {
fun shouldLog(snapshot: NotificationSnapshot, logGroupSummaries: Boolean): Boolean =
logGroupSummaries || !snapshot.isGroupSummary
shouldLog(snapshot, action = null, logGroupSummaries)
fun shouldLog(
snapshot: NotificationSnapshot,
action: NotificationAction?,
logGroupSummaries: Boolean,
): Boolean = logGroupSummaries || (
!snapshot.isGroupSummary && action != NotificationAction.GROUP_SUMMARY_CANCELLED
)
}
@@ -85,7 +85,7 @@ class NotificationCaptureService : NotificationListenerService() {
includeContents: Boolean,
previousSnapshot: NotificationSnapshot? = null,
) {
if (!GroupSummaryPolicy.shouldLog(snapshot, captureSettings.logGroupSummaries)) return
if (!GroupSummaryPolicy.shouldLog(snapshot, action, captureSettings.logGroupSummaries)) return
if (!allows(loggingType, snapshot.packageName)) return
val appName = appName(snapshot.packageName)
val retainImage = includeContents && snapshot.imageBytes != null && allows(LoggingType.IMAGE_CONTENT, snapshot.packageName)