Skip to content

fix(android): Handle default-package ANR frame modules (JAVA-696) - #5979

Open
0xadam-brown wants to merge 1 commit into
mainfrom
fix/thread-dump-parser
Open

fix(android): Handle default-package ANR frame modules (JAVA-696)#5979
0xadam-brown wants to merge 1 commit into
mainfrom
fix/thread-dump-parser

Conversation

@0xadam-brown

@0xadam-brown 0xadam-brown commented Aug 21, 2026

Copy link
Copy Markdown
Member

📜 Description

Updates ThreadDumpParser so ANR frames for classes in Java's default package are emitted with the correct module name.

Prior to this PR, when the parser saw a Java or JNI frame whose class has no package, it would reconstruct the frame's module as though a package existed. That turned a class like MainActivity into null.MainActivity.

This PR fixes that by teaching ThreadDumpParser to build the module name conditionally:

  • if a package name is present, emit package.class
  • if no package name is present, emit just class

The same logic is applied consistently to both Java frames and JNI frames, since both parsing paths share the same optional-package shape.

💡 Motivation and Context

Absent this PR, we'd see:

  • an invalid synthetic module name for default-package classes;
  • distored downstream in-app classification, since that logic depends on the module name; and
  • internally inconsistent parsed ANR frames, where the function, file, and line point at one class but the module name points at another, non-existent one.

resolves: JAVA-696

💚 How did you test it?

TDD-style unit tests.

📝 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

@linear-code

linear-code Bot commented Aug 21, 2026

Copy link
Copy Markdown

JAVA-696

Updates `ThreadDumpParser` so ANR frames for classes in Java's default package are emitted with the correct module name.

Prior to this commit, when the parser saw a Java or JNI frame whose class has no package, it would reconstruct the frame's module as though a package existed. That turned a class like `MainActivity` into `null.MainActivity`.

This commit fixes that by teaching `ThreadDumpParser` to build the module name conditionally:

- if a package name is present, emit `package.class`
- if no package name is present, emit just `class`

The same logic is applied consistently to both Java frames and JNI frames, since both parsing paths share the same optional-package shape.
@0xadam-brown
0xadam-brown force-pushed the fix/thread-dump-parser branch from 8df04d2 to a8ad851 Compare August 21, 2026 10:11
@0xadam-brown
0xadam-brown marked this pull request as ready for review August 21, 2026 10:13
@sentry

sentry Bot commented Aug 21, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 354.23 ms 458.84 ms 104.61 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
fc5ccaf 322.49 ms 405.25 ms 82.76 ms
fcec2f2 328.91 ms 387.75 ms 58.84 ms
f064536 327.04 ms 405.35 ms 78.31 ms
0eaac1e 320.04 ms 369.52 ms 49.48 ms
1edbdfa 364.77 ms 450.29 ms 85.52 ms
057ba36 305.64 ms 379.43 ms 73.79 ms
ad8da22 362.98 ms 453.94 ms 90.96 ms
d15471f 369.38 ms 459.08 ms 89.70 ms
926b414 319.88 ms 362.02 ms 42.14 ms
d15471f 302.62 ms 353.84 ms 51.22 ms

App size

Revision Plain With Sentry Diff
fc5ccaf 1.58 MiB 2.13 MiB 557.54 KiB
fcec2f2 1.58 MiB 2.12 MiB 551.50 KiB
f064536 1.58 MiB 2.20 MiB 633.90 KiB
0eaac1e 1.58 MiB 2.19 MiB 619.17 KiB
1edbdfa 1.58 MiB 2.20 MiB 635.34 KiB
057ba36 0 B 0 B 0 B
ad8da22 1.58 MiB 2.29 MiB 719.83 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
926b414 0 B 0 B 0 B
d15471f 1.58 MiB 2.13 MiB 559.54 KiB

@0xadam-brown 0xadam-brown added the sanity-check PR needs a lightweight review for obvious issues label Aug 21, 2026
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.

1 participant