Skip to content

feat(android): Add ANR warning breadcrumbs on Android 17+ - #6245

Open
markushi wants to merge 19 commits into
mainfrom
markushi/feat/anr-warning-listener
Open

markushi wants to merge 19 commits into
mainfrom
markushi/feat/anr-warning-listener

Conversation

@markushi

@markushi markushi commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

📜 Description

Adds new Integration: AnrWarningListenerIntegration.

On Android 17 (API 37) and above, it subscribes to ActivityManager.registerAnrWarningListener, and transforms the warnings into app.anr breadcrumbs.

The features is enabled by default, but can be disabled via the setEnableAnrWarningBreadcrumbs() or manifest option.

In order for the tests to work, robolectric was bumped along the way.

💡 Motivation and Context

💚 How did you test it?

  • Added unit tests
  • Verified the description on the Android 17 emulator (API 37, CP41.260828.004.A7): a temporary instrumentation test sent ordered foreground broadcasts with am broadcast and read AnrWarningResult.getDescription():
Data URI sent dat= in the description
tel:+43-660-1234567 tel:xxx-xxx-xxxxxxx
https://user:pw@example.com:8443/SECRETPATH?q=SECRETQ https://example.com:8443/...
content://com.example.provider/contacts/42/secretpath?token=SECRETQ#SECRETF + extra secret_extra=SECRETEXTRA content://com.example.provider/... and (has extras)

📝 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

  • Docs: add the app.anr breadcrumb to the Android breadcrumbs page.

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Oct 12, 2026

Copy link
Copy Markdown

JAVA-771

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 260c9a8

@sentry

sentry Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

Base automatically changed from build/jdk-21 to main October 21, 2026 09:56
@getsentry getsentry deleted a comment from sentry-junior Bot Nov 9, 2026
@markushi
markushi marked this pull request as ready for review November 9, 2026 08:32
@markushi
markushi requested review from a team and adinauer as code owners November 9, 2026 08:32
@markushi
markushi requested review from 0xadam-brown and runningcode and removed request for a team November 9, 2026 08:32

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 260c9a8.

Main concerns: public contract, reach, data sent to Sentry.

Rules that block low also fired:

  • R4: a public API record changed: sentry-android-core/api/sentry-android-core.api
  • R5: dependencies or bundled SDK versions changed: gradle/libs.versions.toml
  • R6: build or release configuration changed: build-logic/src/main/kotlin/io/sentry/gradle/JdkTargetConvention.kt, build-logic/src/main/kotlin/io/sentry/gradle/SentryRobolectricPlugin.kt, gradle/libs.versions.toml

This label is a hint for reviewers, not an approval.

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 26, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 26, 2026

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b8c340d. Configure here.

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 26, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 26, 2026
@markushi markushi added the sanity-check PR needs a lightweight review for obvious issues label Nov 27, 2026

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

risk: medium PR risk score: medium sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for reporting AnrWarnings

1 participant