Cancel notifications by tag and id, not id alone#5553
Conversation
Pass the notification tag to cancel when present so tagged notifications are dismissed, and cancel by id unconditionally when there is no tag. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @geekygecko's task in 1m 1s —— View job PR Review: NOTIF-02 — Cancel notifications by tag and id
SummaryThe change is correct and low-risk. Android keys active notifications by the Correctness
Observations (non-blocking)1. The only current caller posts without a tag. 2. Duplicated cancel logic. This block is now a near-exact copy of 3. Pre-existing: redundant Tests
VerdictLooks good to merge. The two-line change is correct, safe, and consistent with existing code. The notes above are optional follow-ups, not blockers. |
|
Claude finished @geekygecko's task in 40s —— View job PR Review: NOTIF-02 — Cancel notifications by tag and id
SummaryThe change is correct and low-risk. Android keys active notifications by the Correctness
Observations (non-blocking)1. Both current callers post without a tag. The two callers in 2. Duplicated cancel logic. This block is now a near-copy of 3. Pre-existing: redundant Tests
VerdictLooks good to merge. The two-line change is correct, safe, and consistent with existing code. The notes above are optional follow-ups, not blockers. |
|
I tried the self approve skill on this PR. |
Description
NotificationHelperImpl.removeNotification()cancelled notifications by ID alone. When a notification is posted with a tag,NotificationManager.cancel(id)does not dismiss it, because Android keys active notifications by the(tag, id)pair. As a result, tagged notifications (e.g. playback error notifications) could linger after the user acted on them.This method is currently only used by the bookmarks feature. I’m not entirely sure the fix is necessary, as tapping the “Change title” action in the notification appears to dismiss it already. That said, I’m not certain whether this behavior is consistent across older Android versions.
This issue was identified during our AI bug hunt, and the fix is straightforward. It also makes sense to address it now in case this method is used elsewhere in the app in the future.
Testing Instructions
removeNotification(e.g. tap the action that dismisses/handles the notification).Screenshots or Screencast
Not applicable, no UI changes.
Checklist
./gradlew spotlessApplyto automatically apply formatting/linting)modules/services/localization/src/main/res/values/strings.xml