-
-
Notifications
You must be signed in to change notification settings - Fork 468
Description
Integration
sentry-android
Build System
Gradle
AGP Version
7.1.2
Proguard
Disabled
Version
5.6.3
Steps to Reproduce
- Create an app that initializes Sentry inside your Application class's onCreate method
- Enable "Do Not Keep Activities" inside an Android device's developer options
- Start the app
- Background the app
- Resume the app
- Note on the Sentry dashboard that no "Warm" start performance events are captured, only "Cold" starts
Expected Result
This docs make a distinction between Cold and Warm app starts. From what it says, I would expect the above steps to trigger a Warm start.
Actual Result
Only Cold start events are reported. I looked into the SDK code and discovered there's a ActivityLifecycleIntegration variable called firstActivityCreated which gets stuck on true after first launch. Seemingly this prevents setColdStart(false) from being called, and hence Warm start events from registering:
private void setColdStart(final @Nullable Bundle savedInstanceState) {
if (!firstActivityCreated) {
// if Activity has savedInstanceState then its a warm start
// https://developer.android.com/topic/performance/vitals/launch-time#warm
AppStartState.getInstance().setColdStart(savedInstanceState == null);
}
Looking at the code it's unclear when firstActivityCreated could become false again, except after a full application restart (in which case it should of course be considered a Cold start). If it matters: my application uses a single Activity and initializes Sentry programmatically. Thank you!