Skip to content

Commit

Permalink
Remove setOngoing to allow dismissing from lock screen.
Browse files Browse the repository at this point in the history
This reverts part of f5fbdfe whose
motivation I (mis?)remembered as being paranoia about pocket actions,
but more likely was that a dismissed notification might have left the
alarm sound playing indefinitely until the same commit stopped
playback on dismiss (via setDeleteIntent).

Also mildly restructure the "is interesting notification" check since
I got tired of mis-parsing it visually (and added debug as a pre-req
for gmail, as an extra safety guard).
  • Loading branch information
fischman committed Jun 21, 2024
1 parent 00a7a17 commit a0090c8
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ class NotificationListener : NotificationListenerService() {
@Suppress("DEPRECATION")
mp.setAudioStreamType(AudioManager.STREAM_ALARM)
mp.isLooping = true

}

override fun onNotificationPosted(sbn: StatusBarNotification) {
if (// sbn.packageName != "com.google.android.gm" && // Debug using Gmail chat notifications.
sbn.packageName != "com.google.android.calendar"
) {
return
}
val interesting = // (debug && sbn.packageName == "com.google.android.gm") || // Debug using Gmail chat notifications.
sbn.packageName == "com.google.android.calendar"
if (!interesting) { return }

// Other places that text can be stored in in Notifications. Possibly of future interest for apps other than GCal and GMail.
if (0 > 1) {
Expand Down Expand Up @@ -114,7 +112,6 @@ class NotificationListener : NotificationListenerService() {
.setContentTitle(label)
.setContentText("")
.setCategory(Notification.CATEGORY_CALL)
.setOngoing(true)
.setFlag(Notification.FLAG_NO_CLEAR, true)
.setDeleteIntent(stopIntent)
.addAction(
Expand Down

0 comments on commit a0090c8

Please sign in to comment.