Skip to content

ref(android): Extract ANR culprit exceptions into AnrCulpritEventHelper - #6593

Open
markushi wants to merge 5 commits into
mainfrom
markushi/feat/nfanr-2-culprit-helper
Open

markushi wants to merge 5 commits into
mainfrom
markushi/feat/nfanr-2-culprit-helper

Conversation

@markushi

Copy link
Copy Markdown
Member

📜 Description

Moves the code that turns an ANR profile culprit into event exceptions out of ApplicationExitInfoEventProcessor into a new AnrCulpritEventHelper:

  • toSentryExceptions(culprit, mechanism) builds the ApplicationNotResponding exception from the culprit stack.
  • hasOnlySystemFrames(exceptions) decides whether an ANR gets the static system-frames fingerprint.

The fatal ANR event does not change.

💡 Motivation and Context

Prep work for non-fatal ANRs. The non-fatal ANR event needs the same culprit exception and fingerprint rule as the fatal one, so both event producers will share this helper.

💚 How did you test it?

Added AnrCulpritEventHelperTest. The existing ApplicationExitInfoEventProcessorTest and AnrV2IntegrationTest pass without changes.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

The non-fatal ANR integration will use this helper.

#skip-changelog

🤖 Generated with Claude Code

@sentry

sentry Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.64.0 (1) release

⚙️ sentry-android Build Distribution Settings

*/
final class ApplicationNotResponding extends RuntimeException {
@ApiStatus.Internal
public final class ApplicationNotResponding extends RuntimeException {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

had to change the visibility, otherwise the helper could not have accessed it. Moving this class probably isn't an option, as it's used for captureException() and thus could influence issue grouping.

@markushi
markushi marked this pull request as ready for review November 12, 2026 10:55
@markushi
markushi requested review from a team and adinauer as code owners November 12, 2026 10:55
@markushi
markushi requested review from 0xadam-brown and romtsn and removed request for a team November 12, 2026 10:55
@markushi markushi added the sanity-check PR needs a lightweight review for obvious issues label Nov 12, 2026

@0xadam-brown 0xadam-brown left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One quick question in case it's helpful; otherwise lgtm 👍

import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
public final class AnrCulpritEventHelper {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I imagine I'll learn more as more PRs emerge, but (for now) it looks like there's a lot of overlap between this class an the existing AnrCulpritIdentifier. Just making sure we don't want to extend the latter instead?

(Happy to defer to you.)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants