Skip to content

fix(android): identify and correctly structure Java/Kotlin frames…#5116

Open
supervacuus wants to merge 4 commits intomainfrom
fix/android/id_java_kotlin_frames_tombstone
Open

fix(android): identify and correctly structure Java/Kotlin frames…#5116
supervacuus wants to merge 4 commits intomainfrom
fix/android/id_java_kotlin_frames_tombstone

Conversation

@supervacuus
Copy link
Collaborator

@supervacuus supervacuus commented Feb 25, 2026

…in mixed Tombstone stack traces.

📜 Description

This PR adds:

  • identification of platform="java" in mixed platform Tombstone stack frames
  • restructuring of those platform="java" frames to the expected backend format (using module, function, and platform: "java" instead of package, function, instruction_addr as used for native frames)
  • a snapshot test against the tombstone that checks the identification of Java frames and in-app doesn't regress

💡 Motivation and Context

This is a planned item of the "wrap-up" UI improvements in https://linear.app/getsentry/project/tombstone-support-android-0024cb6e3ffd/

It covers the SDK part of https://linear.app/getsentry/issue/ANDROID-265/improve-ux-for-mixed-stacktraces (getsentry/sentry#107318).

💚 How did you test it?

📝 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.

🔮 Next steps

@linear
Copy link

linear bot commented Feb 25, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (android) Identify and correctly structure Java/Kotlin frames… by supervacuus in #5116
  • Safe unregister SystemEventsBroadcastReceiver by kollesnica1337 in #5106

Internal Changes 🔧

Deps

  • Bump github/codeql-action from 4.32.2 to 4.32.4 by dependabot in #5109
  • Bump getsentry/craft from 2.21.2 to 2.21.7 by dependabot in #5110

🤖 This preview updates automatically when you update the PR.

@supervacuus
Copy link
Collaborator Author

While testing this manually, it became apparent that the SDK-level inApp detection and the one on the server disagree. See here: https://sentry-sdks.sentry.io/issues/7288803722/events/af5e7573571f4cd98616f947e081ad09/

In the event, only the JNI frame is kept as inApp because it is a native frame. The Java frames from the package are marked as "framework" -> "system (see the data property for evidence of an overwrite):

image

Not sure if this is really a problem, but it certainly was unexpected.

Please also keep in mind that this PR should be blocked for merging/releasing until UI issues are fixed here: getsentry/sentry#107318. For instance, currently, there is no stable rendering between native and Java frames.

Copy link

@cursor cursor bot left a comment

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 and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

} else {
return "";
}
}
Copy link

Choose a reason for hiding this comment

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

extractJavaModuleName returns empty string instead of null

Low Severity

extractJavaModuleName is annotated @Nullable but returns "" instead of null in the else branch. Since SentryStackFrame.serialize() only checks if (module != null) before writing, an empty string causes "module":"" to appear in the serialized JSON. This differs from the null case where the field is omitted entirely, which could affect backend grouping or display logic for any Java frame whose function name has no dots.

Fix in Cursor Fix in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That was intentional because the backend expects the property (although there is often only a truthy check); however, we can also set it to null. @markushi and @romtsn, any feelings about this?

@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 318.77 ms 364.60 ms 45.83 ms
Size 1.58 MiB 2.29 MiB 720.12 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d15471f 361.89 ms 378.07 ms 16.18 ms
6edfca2 305.52 ms 432.78 ms 127.26 ms
ed33deb 337.52 ms 484.06 ms 146.54 ms
f064536 349.86 ms 417.66 ms 67.80 ms
d217708 409.83 ms 474.72 ms 64.89 ms
23d6b12 354.10 ms 408.38 ms 54.28 ms
ad8da22 362.98 ms 453.94 ms 90.96 ms
ee747ae 374.71 ms 455.18 ms 80.47 ms
33a08cc 267.08 ms 340.45 ms 73.37 ms
2124a46 319.19 ms 415.04 ms 95.85 ms

App size

Revision Plain With Sentry Diff
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
6edfca2 1.58 MiB 2.13 MiB 559.07 KiB
ed33deb 1.58 MiB 2.13 MiB 559.52 KiB
f064536 1.58 MiB 2.20 MiB 633.90 KiB
d217708 1.58 MiB 2.10 MiB 532.97 KiB
23d6b12 1.58 MiB 2.10 MiB 532.31 KiB
ad8da22 1.58 MiB 2.29 MiB 719.83 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
33a08cc 1.58 MiB 2.12 MiB 555.28 KiB
2124a46 1.58 MiB 2.12 MiB 551.51 KiB

Previous results on branch: fix/android/id_java_kotlin_frames_tombstone

Startup times

Revision Plain With Sentry Diff
b9f7b6b 296.53 ms 355.34 ms 58.81 ms

App size

Revision Plain With Sentry Diff
b9f7b6b 1.58 MiB 2.29 MiB 720.04 KiB

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.

1 participant