Skip to content

[VBLOCKS-6682] Clean up potential null records after process end#693

Open
mhuynh5757 wants to merge 3 commits into
mainfrom
task/null-intent-after-process-end
Open

[VBLOCKS-6682] Clean up potential null records after process end#693
mhuynh5757 wants to merge 3 commits into
mainfrom
task/null-intent-after-process-end

Conversation

@mhuynh5757

Copy link
Copy Markdown
Collaborator

Submission Checklist

  • Updated the CHANGELOG.md to reflect any feature, bug fixes, or known issues made in the source code
  • Tested code changes and observed expected behavior in the example app
  • Performed a visual inspection of the Files changed tab prior to submitting the pull request for review to ensure proper usage of the style guide

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

Description

This PR implements cleanup functions upon process end to reduce null pointer exceptions around in-memory and invalidated call records.

Breakdown

  • Clean up call records when invalidated (i.e. when the process ends and the in-memory data is invalidated).

Validation

  • Manually tested with test app.

Additional Notes

N/A

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce Android-side NullPointerException crashes by cleaning up in-memory call invite/call record state when the app process/task ends (e.g., user swipes the app away or the OS kills the process), and by making disconnect/cancel flows tolerant of missing records.

Changes:

  • Add VoiceService.onTaskRemoved cleanup to reject active incoming invites when the task is removed.
  • Make ACTION_CALL_DISCONNECT gracefully handle missing call records by clearing stale foreground notifications instead of crashing.
  • Adjust FCM invite/cancel handling to better tolerate already-cleaned-up records, and document the fixes in the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
CHANGELOG.md Adds release notes describing the Android crash fixes and cleanup behavior.
android/src/main/java/com/twiliovoicereactnative/VoiceService.java Adds task-removal cleanup and makes disconnect tolerant of missing call records.
android/src/main/java/com/twiliovoicereactnative/VoiceFirebaseMessagingService.java Routes incoming invite handling through startService and makes cancelled-invite handling tolerate missing call records.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +37 to +44
// Route through startService so VoiceService enters the "started" state,
// which is what causes onTaskRemoved to fire when the user swipes the app away.
final Context context = VoiceApplicationProxy.getApplicationContext();
context.startService(VoiceService.constructMessage(
context,
Constants.ACTION_INCOMING_CALL,
VoiceService.class,
callRecord.getUuid()));
Comment on lines +179 to +182
} catch (Exception e) {
logger.warning(e, "Failed to reject invite during task removal");
removeNotification(callRecord.getNotificationId());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants