Skip to content

Commit

Permalink
fix(Session Tracker) fixed logic of discarding session
Browse files Browse the repository at this point in the history
  • Loading branch information
YYChen01988 committed May 23, 2024
1 parent 6c29641 commit 4e298d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
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

0 comments on commit 4e298d7

Please sign in to comment.