diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e501cbd60..bb2b1d9094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## TBD + +### Bug fixes + +* Corrected the behavior when `Bugsnag.startSession` is called when `config.autoTrackSessions=true`, the first automatic session will now be correctly discarded + [#2033](https://github.com/bugsnag/bugsnag-android/pull/2033) + ## 6.5.0 (2024-05-15) ### Enhancements diff --git a/bugsnag-android-core/src/main/java/com/bugsnag/android/SessionTracker.java b/bugsnag-android-core/src/main/java/com/bugsnag/android/SessionTracker.java index 9fc2747f5b..25fb7058c4 100644 --- a/bugsnag-android-core/src/main/java/com/bugsnag/android/SessionTracker.java +++ b/bugsnag-android-core/src/main/java/com/bugsnag/android/SessionTracker.java @@ -36,7 +36,7 @@ class SessionTracker extends BaseObservable implements ForegroundDetector.OnActi private volatile Session currentSession = null; final BackgroundTaskService backgroundTaskService; final Logger logger; - private boolean shouldSuppressFirstAutoSession = false; + private boolean shouldSuppressFirstAutoSession = true; SessionTracker(ImmutableConfig configuration, CallbackState callbackState, @@ -108,9 +108,13 @@ private boolean shouldDiscardSession(boolean autoCaptured) { && existingSession != null && !existingSession.isAutoCaptured() && shouldSuppressFirstAutoSession) { - shouldSuppressFirstAutoSession = true; + shouldSuppressFirstAutoSession = false; return true; } + + if (autoCaptured) { + shouldSuppressFirstAutoSession = false; + } } return false; }