Repository navigation
fix(android): preserve app start type when launch activity is destroyed early - #6809
Closed
sahuadarsh0 wants to merge 1 commit into
Closed
sahuadarsh0 wants to merge 1 commit into
sahuadarsh0 wants to merge 1 commit into
Conversation
sahuadarsh0
requested review from
0xadam-brown and
runningcode
and removed request for
a team
November 30, 2026 09:56
Contributor
PR risk: mediumFor commit Main concerns: data sent to Sentry, reach, host performance. This label is a hint for reviewers, not an approval. |
Contributor
|
Thanks for opening. Please read our contributing guide before opening a PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Record the classified app start type (
cold/warm) inAPP_START_TYPE_DATAwhenActivityLifecycleIntegrationcreates or updates a standaloneapp.starttransaction (foreground launch, headless start, and eager extension), and resolve the start type inPerformanceAndroidEventProcessorfrom the transaction's ownapp.start.cold/app.start.warmchild span or recordedAPP_START_TYPE_DATAbefore falling back toAppStartMetrics.getAppStartType().💡 Motivation and Context
When the launch activity is destroyed while its
ui.loador standaloneapp.starttransaction is still open,AppStartMetrics.onActivityDestroyedruns first and flipsappStartTypetoWARMfor the next launch.ActivityLifecycleIntegration.onActivityDestroyedthen finishes the open transaction on the same thread, andPerformanceAndroidEventProcessorpreviously read the already-mutatedAppStartMetricssingleton, reporting the ending cold start as warm.💚 How did you test it?
Added unit tests in
PerformanceAndroidEventProcessorTest(both non-standaloneapp.start.coldspan and standaloneapp.starttransaction paths whenAppStartMetricsflips toWARMbefore processing) andActivityLifecycleIntegrationTest(reproducingAppStartMetrics.onActivityDestroyedrunning beforeActivityLifecycleIntegration.onActivityDestroyedin standalone mode).Ran
:sentry-android-core:testReleaseUnitTestacrossPerformanceAndroidEventProcessorTest,ActivityLifecycleIntegrationTest, andAppStartMetricsTest(225 tests passing) plus:sentry-android-core:spotlessCheck.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.