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 50bb08a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 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

* When `Bugsnag.startSession` is called with automatic session tracking mixed with manual session, discard the first automatic session.
[#2033](https://github.com/bugsnag/bugsnag-android/pull/2033)

## 6.5.0 (2024-05-15)

### Enhancements
Expand Down
1 change: 0 additions & 1 deletion bugsnag-android-core/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
<ID>SwallowedException:DeviceDataCollector.kt$DeviceDataCollector$exception: Exception</ID>
<ID>SwallowedException:DeviceIdFilePersistence.kt$DeviceIdFilePersistence$exc: OverlappingFileLockException</ID>
<ID>SwallowedException:EventStore.kt$EventStore$exception: RejectedExecutionException</ID>
<ID>SwallowedException:EventStore.kt$EventStore$ioe: Exception</ID>
<ID>SwallowedException:ForegroundDetector.kt$ForegroundDetector$e: Exception</ID>
<ID>SwallowedException:ImmutableConfig.kt$e: Exception</ID>
<ID>SwallowedException:JsonHelperTest.kt$JsonHelperTest$e: IllegalArgumentException</ID>
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 50bb08a

Please sign in to comment.