fix(android): Improve app start type detection with main thread timing by markushi · Pull Request #4999 · getsentry/sentry-java

added 2 commits

December 29, 2025 10:14

sentry[bot]

@markushi

@markushi

@markushi

@markushi

@markushi

As firstPost doesn't work on Android 34+ devices

@markushi markushi marked this pull request as ready for review

January 16, 2026 11:02

cursor[bot]

romtsn

romtsn

@markushi

- Add support for ApplicationStartInfo API on Android 15+ (API 35) for more accurate cold/warm start detection
- Add null safety check for ActivityManager service
- Fix detection logic to prevent legacy methods from running when API 35+ already determined start type
- Set app start type to WARM when app moves to background (process stays alive)
- Add comprehensive test coverage with notification-triggered start scenarios

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@markushi

cursor[bot]

@markushi

@markushi

cursor[bot]

@markushi

@markushi

sentry[bot]

sentry[bot]

@markushi

@markushi

…entry-java into fix/app-start-warm-detection

@markushi

@markushi

@markushi

romtsn

romtsn

romtsn

romtsn

romtsn

@markushi

@markushi

Add custom SentryShadowActivityManager to mock ApplicationStartInfo
for testing cold/warm start detection on Android 15 (API 35).

Tests verify the new getHistoricalProcessStartReasons() code path
and fallback behavior when the list is empty or invalid.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@getsentry-bot

romtsn

@markushi

@markushi markushi deleted the fix/app-start-warm-detection branch

February 6, 2026 18:06