debug: Add early logging to NotificationListener

Log immediately when onNotificationPosted is called to diagnose
if the listener is firing at all.
This commit is contained in:
James (ClawdBot) 2026-01-28 20:13:13 +00:00
parent a1e94f559f
commit 5eb13b01b5
1 changed files with 20 additions and 4 deletions

View File

@ -55,25 +55,41 @@ class NotificationListener : NotificationListenerService() {
} }
override fun onNotificationPosted(sbn: StatusBarNotification) { override fun onNotificationPosted(sbn: StatusBarNotification) {
// Log immediately to confirm listener is working
Log.i(tag, "onNotificationPosted called: ${sbn.packageName}")
ClawdNodeApp.instance.auditLog.log(
"NOTIFICATION_RAW",
"Received: ${sbn.packageName}",
mapOf("id" to sbn.id.toString(), "key" to sbn.key)
)
// Skip our own notifications // Skip our own notifications
if (sbn.packageName == packageName) return if (sbn.packageName == packageName) {
Log.d(tag, "Skipping own notification")
return
}
// Skip ongoing/persistent notifications (media players, etc.) // Skip ongoing/persistent notifications (media players, etc.)
if (sbn.isOngoing && !isImportantOngoing(sbn)) return if (sbn.isOngoing && !isImportantOngoing(sbn)) {
Log.d(tag, "Skipping ongoing notification")
return
}
Log.d(tag, "Notification posted: ${sbn.packageName}") Log.d(tag, "Processing notification: ${sbn.packageName}")
val notificationId = generateNotificationId(sbn) val notificationId = generateNotificationId(sbn)
activeNotifications[notificationId] = sbn activeNotifications[notificationId] = sbn
val event = createNotificationEvent(sbn, notificationId) val event = createNotificationEvent(sbn, notificationId)
nodeService?.sendEvent(event)
ClawdNodeApp.instance.auditLog.logNotification( ClawdNodeApp.instance.auditLog.logNotification(
"NOTIFICATION_POSTED", "NOTIFICATION_POSTED",
sbn.packageName, sbn.packageName,
event.title event.title
) )
nodeService?.sendEvent(event)
Log.i(tag, "Notification event sent to gateway")
} }
override fun onNotificationRemoved(sbn: StatusBarNotification) { override fun onNotificationRemoved(sbn: StatusBarNotification) {