Skip to content

Commit a5c8271

Browse files
committed
Change the order of the process state listen invocation
1 parent c5e174d commit a5c8271

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

embrace-android-core/src/main/kotlin/io/embrace/android/embracesdk/internal/session/lifecycle/EmbraceProcessStateService.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,14 @@ internal class EmbraceProcessStateService(
8484
override fun onBackground() {
8585
isInBackground = true
8686
val timestamp = clock.now()
87-
invokeCallbackSafely { sessionOrchestrator?.onBackground(timestamp) }
8887

8988
stream<ProcessStateListener>(listeners) { listener: ProcessStateListener ->
9089
invokeCallbackSafely {
9190
listener.onBackground(timestamp)
9291
}
9392
}
93+
94+
invokeCallbackSafely { sessionOrchestrator?.onBackground(timestamp) }
9495
}
9596

9697
private inline fun invokeCallbackSafely(action: () -> Unit) {

embrace-android-core/src/test/java/io/embrace/android/embracesdk/internal/session/EmbraceProcessStateServiceTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ internal class EmbraceProcessStateServiceTest {
179179
invocations.clear()
180180
stateService.onBackground()
181181
val backgroundExpected = listOf(
182+
"DecoratedListener",
182183
"DecoratedSessionOrchestrator",
183-
"DecoratedListener"
184184
)
185185
assertEquals(backgroundExpected, invocations)
186186
}

0 commit comments

Comments
 (0)