File tree Expand file tree Collapse file tree
main/java/io/sentry/android/core
test/java/io/sentry/android/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1024,21 +1024,19 @@ private void onHeadlessAppStart() {
10241024 return ;
10251025 }
10261026
1027- // Persist the end time so a later activity can decide whether its ui.load is close enough in
1028- // time to continue this trace; without it the continuation window is treated as unbounded.
1027+ // Persist the end time so a later ui.load can tell whether it is close enough to continue this
1028+ // trace; without it the continuation window is unbounded.
10291029 metrics .setAppStartEndTime (endTime );
10301030
10311031 final @ NotNull AppStartExtension extension = metrics .getAppStartExtension ();
1032- // Extended headless start still open: finish the existing eager txn at the headless end instead
1033- // of creating a second one.
10341032 if (extension .isActive ()) {
1033+ // Extended start still open: finish the eager txn instead of creating a second one.
10351034 extension .finishTransaction (endTime );
10361035 return ;
10371036 }
1038- // The extension already created and finished the standalone app.start for this launch
1039- // (finishExtendedAppStart() or the deadline ran before this headless check). Don't duplicate
1040- // it.
10411037 if (!metrics .shouldSendStartMeasurements (true )) {
1038+ // The extension already created and finished this app.start (finishExtendedAppStart or the
1039+ // deadline); don't create a duplicate.
10421040 return ;
10431041 }
10441042
Original file line number Diff line number Diff line change @@ -453,8 +453,6 @@ class ActivityLifecycleIntegrationTest {
453453
454454 driveHeadlessAppStart()
455455
456- // Without persisting the end time, the continuation window is treated as unbounded and a later
457- // activity would wrongly continue this trace.
458456 assertNotNull(AppStartMetrics .getInstance().getAppStartEndTime())
459457 }
460458
@@ -469,15 +467,14 @@ class ActivityLifecycleIntegrationTest {
469467
470468 prepareHeadlessAppStart(appStartType = AppStartType .COLD )
471469 AppStartMetrics .getInstance().appStartExtension.extendAppStart()
472- // The user finishes the extension and its app.start is sent (onAppStartSpansSent, normally
473- // driven by the event processor) before the headless idle check runs.
470+ // Finish and send the extension's app.start (onAppStartSpansSent is normally driven by the
471+ // event processor) before the headless idle check runs.
474472 AppStartMetrics .getInstance().appStartExtension.finishExtendedAppStart()
475473 AppStartMetrics .getInstance().onAppStartSpansSent()
476474 val transactionsBefore = fixture.createdTransactions.size
477475
478476 driveHeadlessAppStart()
479477
480- // The eager extension txn already covered this launch; no second standalone app.start.
481478 assertEquals(transactionsBefore, fixture.createdTransactions.size)
482479 }
483480
You can’t perform that action at this time.
0 commit comments