Skip to content

Conversation

@markushi
Copy link
Member

📜 Description

Adds support for Android 15+ (API 35) ApplicationStartInfo API to collect detailed app startup timing data and create a custom transaction with enriched AppStartMetrics spans.

Key Features:

  • Uses ActivityManager.addApplicationStartInfoCompletionListener() to capture startup data when current launch completes
  • Creates transactions with op app.start.info and name app.start.{reason} (e.g., app.start.launcher)
  • Includes detailed timing spans:
    • app.start.bind_application - Time from fork to bind application
    • app.start.application_oncreate - Time from fork to Application.onCreate
    • app.start.ttid - Time to initial display (first frame)
    • app.start.ttfd - Time to full display (fully drawn)
  • Enriches with AppStartMetrics data:
    • Content provider onCreate spans with class names
    • Application.onCreate description with class name
  • Tags include: start.reason, start.type (cold/warm/hot), start.launch_mode

Implementation Details:

  • Opt-in feature via SentryAndroidOptions.setEnableApplicationStartInfo(boolean) (disabled by default)
  • Uses completion listener approach (no historical data collection)
  • All spans start from fork time showing cumulative timing

💡 Motivation and Context

Implements #6228

💚 How did you test it?

  • Added comprehensive unit tests (11 tests in ApplicationStartInfoIntegrationTest)
  • Added integration test in AndroidOptionsInitializerTest

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

  • May add additional tags when more data becomes available in future Android API levels

@github-actions
Copy link
Contributor

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

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


New Features ✨

  • (android) Add ApplicationStartInfo API support for Android 15+ by markushi in #5056

Internal Changes 🔧

  • (android) Update targetSdk to API 36 (Android 16) by markushi in #5016
  • (ci) Write permission for statuses in changelog preview by supervacuus in #5053

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- Add ApplicationStartInfo API support for Android 15+ ([#5056](https://github.com/getsentry/sentry-java/pull/5056))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against 2226b2d

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 307.57 ms 360.40 ms 52.83 ms
Size 1.58 MiB 2.19 MiB 622.66 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
dba088c 333.98 ms 381.16 ms 47.18 ms
91bb874 310.68 ms 359.24 ms 48.56 ms
d15471f 315.61 ms 360.22 ms 44.61 ms
27d7cf8 314.17 ms 347.00 ms 32.83 ms
a5ab36f 316.83 ms 394.54 ms 77.71 ms
5b66efd 308.67 ms 363.85 ms 55.18 ms
abfcc92 337.38 ms 427.39 ms 90.00 ms
fc5ccaf 279.11 ms 353.34 ms 74.23 ms
fcec2f2 328.91 ms 387.75 ms 58.84 ms
dba088c 365.46 ms 366.31 ms 0.85 ms

App size

Revision Plain With Sentry Diff
dba088c 1.58 MiB 2.13 MiB 558.99 KiB
91bb874 1.58 MiB 2.13 MiB 559.07 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
27d7cf8 1.58 MiB 2.12 MiB 549.42 KiB
a5ab36f 1.58 MiB 2.12 MiB 555.26 KiB
5b66efd 1.58 MiB 2.13 MiB 559.07 KiB
abfcc92 1.58 MiB 2.13 MiB 557.31 KiB
fc5ccaf 1.58 MiB 2.13 MiB 557.54 KiB
fcec2f2 1.58 MiB 2.12 MiB 551.50 KiB
dba088c 1.58 MiB 2.13 MiB 558.99 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.

2 participants