feat: silent-filter ongoing notifications (no log entry)
持续性通知(音乐/下载/通话中等)不再写日志,静默丢弃 Decision 新增 silent 字段,NotifyListenerService 跳过静默过滤的日志 版本 1.4.0 → 1.4.1 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,8 +13,8 @@ android {
|
||||
applicationId = "com.a2i.forwarder"
|
||||
minSdk = 34
|
||||
targetSdk = 36
|
||||
versionCode = 5
|
||||
versionName = "1.4.0"
|
||||
versionCode = 6
|
||||
versionName = "1.4.1"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
@@ -16,6 +16,7 @@ class NotificationProcessor(private val context: Context) {
|
||||
val reason: String,
|
||||
val appLabel: String,
|
||||
val code: String?,
|
||||
val silent: Boolean = false, // true = 静默过滤,不写日志
|
||||
)
|
||||
|
||||
// ========== 去重缓存 ==========
|
||||
@@ -88,10 +89,10 @@ class NotificationProcessor(private val context: Context) {
|
||||
if (!settings.forwardingEnabled.value)
|
||||
return Decision(null, "全局转发已关", appLabel, null)
|
||||
|
||||
// ---- 持续性通知过滤 ----
|
||||
// ---- 持续性通知过滤(静默,不进日志)----
|
||||
val isOngoing = n.flags and Notification.FLAG_ONGOING_EVENT != 0
|
||||
if (settings.skipOngoing.value && isOngoing)
|
||||
return Decision(null, "持续性通知", appLabel, null)
|
||||
return Decision(null, "持续性通知", appLabel, null, silent = true)
|
||||
|
||||
// ---- App 黑白名单 ----
|
||||
if (!rules.isForwardingOn(pkg))
|
||||
|
||||
@@ -40,7 +40,10 @@ class NotifyListenerService : NotificationListenerService() {
|
||||
val msg = d.message
|
||||
|
||||
if (msg == null) {
|
||||
// 静默过滤(如持续性通知)不写日志
|
||||
if (!d.silent) {
|
||||
app.logStore.addLog(ForwardLog(now, sbn.packageName, d.appLabel, "", "", "filtered", d.reason))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user