Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Fix Ensure app start type is set, even when ActivityLifecycleIntegration is not running ([#4216](https://github.com/getsentry/sentry-java/pull/4216))
- Fix properly reset application/content-provider timespans for warm app starts ([#4244](https://github.com/getsentry/sentry-java/pull/4244))

## 7.22.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle saved
appStartSpan.start();
appStartSpan.setStartedAt(nowUptimeMs);
CLASS_LOADED_UPTIME_MS = nowUptimeMs;
contentProviderOnCreates.clear();
applicationOnCreate.reset();
} else {
appStartType = savedInstanceState == null ? AppStartType.COLD : AppStartType.WARM;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ class AppStartMetricsTest {
val metrics = AppStartMetrics.getInstance()
metrics.registerLifecycleCallbacks(mock<Application>())

metrics.contentProviderOnCreateTimeSpans.add(
TimeSpan().apply {
description = "ExampleContentProvider"
setStartedAt(1)
setStoppedAt(2)
}
)

metrics.applicationOnCreateTimeSpan.apply {
setStartedAt(3)
setStoppedAt(4)
}

// when the looper runs
Shadows.shadowOf(Looper.getMainLooper()).idle()

Expand All @@ -173,6 +186,8 @@ class AppStartMetricsTest {
assertTrue(metrics.shouldSendStartMeasurements())
assertTrue(metrics.appStartTimeSpan.hasStarted())
assertEquals(now, metrics.appStartTimeSpan.startUptimeMs)
assertFalse(metrics.applicationOnCreateTimeSpan.hasStarted())
assertTrue(metrics.contentProviderOnCreateTimeSpans.isEmpty())
}

@Test
Expand Down
Loading