Skip to content

Commit cedf2bd

Browse files
authored
Merge pull request #2623 from DataDog/jmoskovich/rum-7956/background-launch
RUM-7956: Fix background session start reason
2 parents 2423b31 + c1ad240 commit cedf2bd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumSessionScope.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ internal class RumSessionScope(
202202
lastUserInteractionNs.set(nanoTime)
203203
} else if (isExpired) {
204204
if (backgroundTrackingEnabled && (isBackgroundEvent || isSdkInitInBackground)) {
205-
renewSession(nanoTime, StartReason.INACTIVITY_TIMEOUT)
205+
renewSession(nanoTime, StartReason.BACKGROUND_LAUNCH)
206206
lastUserInteractionNs.set(nanoTime)
207207
} else {
208208
sessionState = State.EXPIRED

features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumSessionScopeTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ internal class RumSessionScopeTest {
108108
@Forgery
109109
lateinit var fakeTimeInfo: TimeInfo
110110

111-
lateinit var fakeInitialViewEvent: RumRawEvent
111+
private lateinit var fakeInitialViewEvent: RumRawEvent
112112

113113
@Mock
114114
lateinit var mockSessionReplayFeatureScope: FeatureScope
@@ -419,7 +419,7 @@ internal class RumSessionScopeTest {
419419
assertThat(result).isSameAs(testedScope)
420420
assertThat(context.sessionId).isNotEqualTo(RumContext.NULL_UUID)
421421
assertThat(context.sessionState).isEqualTo(RumSessionScope.State.TRACKED)
422-
assertThat(context.sessionStartReason).isEqualTo(RumSessionScope.StartReason.INACTIVITY_TIMEOUT)
422+
assertThat(context.sessionStartReason).isEqualTo(RumSessionScope.StartReason.BACKGROUND_LAUNCH)
423423
assertThat(context.applicationId).isEqualTo(fakeParentContext.applicationId)
424424
assertThat(context.viewId).isEqualTo(fakeParentContext.viewId)
425425
}
@@ -608,7 +608,7 @@ internal class RumSessionScopeTest {
608608
.isNotEqualTo(initialContext.sessionId)
609609
.isNotEqualTo(RumContext.NULL_UUID)
610610
assertThat(context.sessionState).isEqualTo(RumSessionScope.State.TRACKED)
611-
assertThat(context.sessionStartReason).isEqualTo(RumSessionScope.StartReason.INACTIVITY_TIMEOUT)
611+
assertThat(context.sessionStartReason).isEqualTo(RumSessionScope.StartReason.BACKGROUND_LAUNCH)
612612
}
613613

614614
@Test
@@ -631,7 +631,7 @@ internal class RumSessionScopeTest {
631631
.isNotEqualTo(initialContext.sessionId)
632632
.isNotEqualTo(RumContext.NULL_UUID)
633633
assertThat(context.sessionState).isEqualTo(RumSessionScope.State.TRACKED)
634-
assertThat(context.sessionStartReason).isEqualTo(RumSessionScope.StartReason.INACTIVITY_TIMEOUT)
634+
assertThat(context.sessionStartReason).isEqualTo(RumSessionScope.StartReason.BACKGROUND_LAUNCH)
635635
}
636636

637637
@Test

0 commit comments

Comments
 (0)