Cancel stale security-check notifications on Verified or Skipped#449
Merged
Merged
Conversation
Previously, when a security check (CT log or self-cert) crossed the warning threshold and posted an info/alert notification, a subsequent Verified or Skipped run reset the in-prefs streak counter but never cleared the notification from the shade. Users were left with stale warnings indicating an outage that had already recovered. Add SecurityCheckNotifier.cancel(check), implement in AndroidSecurityCheckNotifier by cancelling both the alert and info notification ids for the given check, and call it from SecurityCheckWorker's Verified and Skipped branches alongside prefs.resetWarningStreak(). NotificationManager.cancel is idempotent, so cancelling an absent id is a no-op. Closes #448
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a security check posts an alert/info notification and a later run
returns
VerifiedorSkipped, the warning streak is reset inSecurityCheckPreferencesbut the visible notification used to lingerin the shade until the user manually dismissed it.
SecurityCheckNotifier.cancel(check)to the contract interfaceAndroidSecurityCheckNotifierby cancelling both thealert AND info notification ids (
NotificationManager.cancelisidempotent, so cancelling an absent id is a no-op)
notifier.cancel(check)fromSecurityCheckWorker.handleResultin the
VerifiedandSkippedbranches alongside the existingprefs.resetWarningStreak(sourceName)callTest plan
:notifications:testDebugUnitTest— new tests inSecurityCheckNotifierTestverify cancel clears both alert+info,only targets the requested check, and is idempotent on empty shade
:work:testDebugUnitTest— new tests inSecurityCheckWorkerTestverify Verified and Skipped paths invoke
cancel(check), anend-to-end repro (3 warnings -> info posted -> Verified -> cancel
fires), and that Alert paths do NOT cancel themselves
ktlintCheckclean for:notificationsand:workdetektclean tree-wideCloses #448