Filter group summary cancellation logs
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user