Guard Android CallStyle notifications against empty caller names#116
Merged
Conversation
Copilot created this pull request from a session on behalf of
WesUnwin
June 2, 2026 17:44
View session
Member
|
@copilot remove all iOS related changes from this PR. |
Author
Done in commit |
There was a problem hiding this comment.
Pull request overview
This PR hardens Android ongoing-call foreground notifications against crashes when the peer/caller name is null or blank, ensuring NotificationCompat.CallStyle.forOngoingCall(...) always receives a Person with a valid non-empty name.
Changes:
- Introduces
safePeerNameinOngoingCallNotification.build()with a fallback to"unavailable"when the providedpeerNameisnullor whitespace-only. - Uses
safePeerNamewhen building thePersonfor CallStyle notifications (API 28+ path). - Uses
safePeerNamein the legacy (non-CallStyle) notification content text to keep behavior consistent across API levels.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jerry2013
approved these changes
Jun 2, 2026
rex-iotum
approved these changes
Jun 2, 2026
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.
Android foreground call notifications were crashing when the call peer name was null/blank.
NotificationCompat.CallStyle.forOngoingCall(...)requires aPersonwith a non-empty name and throwsIllegalArgumentExceptionotherwise.Crash containment
OngoingCallNotification.build(), introduced a sanitized localsafePeerName.nullor whitespace-onlypeerNamenow resolves to"unavailable".CallStyle path hardening (API 28+)
Person.Builder().setName(...)now usessafePeerNamesoCallStyle.forOngoingCall(...)always receives a valid person name.Consistency for non-CallStyle path
setContentText) now also usessafePeerNameto keep display behavior aligned across API levels.