Repository navigation
Don't crash at startup when an old notification channel is in use - #2247
Draft
mpretty-cyro wants to merge 1 commit into
Draft
mpretty-cyro wants to merge 1 commit into
mpretty-cyro wants to merge 1 commit into
Conversation
Deleting an old notification channel throws SecurityException while a running foreground service posts to it, and NotificationChannelManager is built at startup, so the app crashed on launch. The migration also re-deleted every channel, including the current ones, whenever it was retried. Delete only channels that aren't current, skip any the system refuses, and leave the migration flag unset so those are retried on a later launch.
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.
Contributor checklist
playflavour,debugFixes #1234syntaxDescription
Crash cluster:
SecurityExceptionfromNotificationManager.deleteNotificationChannelinNotificationChannelManager.<init>(remote cause
enforceDeletingChannelHasNoFgService). The channel migration deleted every channel and crashed if a runningforeground service was posting to one; because it's built at startup, the app crashed on launch.
It now deletes only channels that aren't current, skips any the system refuses, and leaves
MIGRATED_FROM_OLD_CHANNELSunset sothose are retried on a later launch (without touching the current channels).
Testing:
NotificationChannelManagerTest(Robolectric): both tests fail without the change and pass with it.