Skip to content

fix: [SDK-5682] release non-OneSignal FCM broadcasts without waiting for the deadline - #2832

Merged
fadi-george merged 2 commits into
mainfrom
fadi/sdk-5682
Nov 5, 2026
Merged

fadi-george merged 2 commits into
mainfrom
fadi/sdk-5682

Conversation

@fadi-george

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Release non-OneSignal FCM broadcasts immediately instead of holding them for the 8s deadline.

Details

Motivation

Fixes #2831. Since 5.11.0, an FCM data message without a custom key makes getOSNotificationIdFromJson pass null into JSONObject, which throws a NullPointerException on Android. The helper only catches JSONException, so suspendifyOnIngress swallows the NPE and skips onSuccess, and FCMBroadcastReceiver holds the ordered broadcast until the 8s BroadcastCompletion deadline. Apps with their own FirebaseMessagingService (e.g. VoIP call pushes) receive their messages 8s late. 5.10.2 avoided this with a null-safe isOneSignalBundle check that #2712 removed.

Scope

  • getOSNotificationIdFromJsonString returns null for a null string, so persistFcm returns false and the receiver finishes right away without aborting.
  • Also covers the other callers of the helper (notification generation, lifecycle service).
  • Not changed: the policy from fix: [SDK-4995] durable ingress lane for background notification receivers #2712 that a failed handoff stays open until the deadline. A missing custom key is no longer a failure, so that policy doesn't apply.

Testing

Unit testing

  • NotificationFormatHelperTests: id from custom, missing custom, non-JSON custom, isOneSignalBundle without custom.
  • NotificationIngressTests: FCM input without a OneSignal payload is rejected without journaling or scheduling.
  • Both missing-custom tests fail with the reported NPE without the fix.

Manual testing

Not tested on device. The change is a null guard covered by unit tests.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

🤖 Generated with Claude Code

…for the deadline

A data message without a custom key made getOSNotificationIdFromJson pass null
into JSONObject, which throws a NullPointerException on Android. The ingress
handoff then never finished and the broadcast was held until the 8s deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fadi-george
fadi-george requested a review from a team as a code owner November 5, 2026 19:25
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

📊 Diff Coverage Report

Diff Coverage Report (Changed Lines Only)

Gate: aggregate coverage on changed executable lines must be ≥ 80% (JaCoCo line data for lines touched in the diff).

Changed Files Coverage

  • NotificationFormatHelper.kt: 3/3 touched executable lines (100.0%) (4 touched lines in diff)

Overall (aggregate gate)

3/3 touched executable lines covered (100.0% — requires ≥ 80%)

📥 View workflow run

@abdulraqeeb33 abdulraqeeb33 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

approve-with-nits

The null guard is the right place, and the missing-custom path now finishes the ordered broadcast instead of waiting out the deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@abdulraqeeb33 abdulraqeeb33 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The debug log is in 6bf7920. A missing custom field now finishes the broadcast and leaves a debug line.

Approved.

@fadi-george
fadi-george merged commit a06ca07 into main Nov 5, 2026
5 checks passed
@fadi-george
fadi-george deleted the fadi/sdk-5682 branch November 5, 2026 20:25
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.

[Bug]: 5.11.0 holds every non-OneSignal FCM broadcast for 8 s (NPE in getOSNotificationIdFromJson when custom is missing)

2 participants