Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the logic of discarding session #2033

Merged
merged 1 commit into from
May 24, 2024
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
Loading