Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
### Fixes

- Android: A crash long after `Sentry.init` is no longer marked as a startup crash when the device slept in between, because the time since init now counts deep sleep ([#6738](https://github.com/getsentry/sentry-java/pull/6738))
- Session Replay: Replays recovered after a crash no longer list `"null"` as a screen name when the last named frame leaves the buffer ([#6827](https://github.com/getsentry/sentry-java/pull/6827))

### Internal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ constructor(
propertyName: String,
crossinline onChange: (propertyName: String?, oldValue: T?, newValue: T?) -> Unit =
{ _, _, newValue ->
cache?.persistSegmentValues(propertyName, newValue.toString())
cache?.persistSegmentValues(propertyName, newValue?.toString())
},
): ReadWriteProperty<Any?, T?> =
object : ReadWriteProperty<Any?, T?> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.sentry.android.replay.capture

import android.graphics.Bitmap
import android.view.MotionEvent
import com.google.common.truth.Truth.assertThat
import io.sentry.DataCategory
import io.sentry.IScopes
import io.sentry.Scope
Expand All @@ -16,6 +17,7 @@ import io.sentry.android.replay.GeneratedVideo
import io.sentry.android.replay.ReplayCache
import io.sentry.android.replay.ReplayCache.Companion.SEGMENT_KEY_ID
import io.sentry.android.replay.ReplayCache.Companion.SEGMENT_KEY_REPLAY_ID
import io.sentry.android.replay.ReplayCache.Companion.SEGMENT_KEY_REPLAY_SCREEN_AT_START
import io.sentry.android.replay.ReplayCache.Companion.SEGMENT_KEY_REPLAY_TYPE
import io.sentry.android.replay.ReplayCache.Companion.SEGMENT_KEY_TIMESTAMP
import io.sentry.android.replay.ReplayFrame
Expand Down Expand Up @@ -250,6 +252,20 @@ class BufferCaptureStrategyTest {
verify(fixture.replayCache).rotate(eq(now - fixture.options.sessionReplay.errorReplayDuration))
}

@Test
fun `clears the persisted screen when the last named frame leaves the buffer`() {
val strategy = fixture.getSut()
strategy.start()
whenever(fixture.replayCache.rotate(any())).thenReturn("HomeActivity", null)

strategy.onScreenshotRecorded {}
assertThat(fixture.persistedSegment[SEGMENT_KEY_REPLAY_SCREEN_AT_START])
.isEqualTo("HomeActivity")

strategy.onScreenshotRecorded {}
assertThat(fixture.persistedSegment[SEGMENT_KEY_REPLAY_SCREEN_AT_START]).isNull()
}

@Test
fun `onConfigurationChanged creates new segment and updates config`() {
val strategy = fixture.getSut()
Expand Down
Loading