Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
3fbaf80
Bump reactivecircus/android-emulator-runner from 2.30.1 to 2.31.0 (#3…
dependabot[bot] Jul 2, 2024
25f1ca4
Bump codecov/codecov-action from 4.3.1 to 4.5.0 (#3533)
dependabot[bot] Jul 2, 2024
e34c467
[SR] Session Replay (#3339)
romtsn Jul 15, 2024
2937c11
release: 7.12.0
getsentry-bot Jul 15, 2024
9c4170f
Merge branch 'release/7.12.0'
Jul 15, 2024
a449452
Bump github/codeql-action from 3.25.10 to 3.25.11 (#3529)
dependabot[bot] Jul 16, 2024
028e225
Bump JamesIves/github-pages-deploy-action from 4.5.0 to 4.6.1 (#3531)
dependabot[bot] Jul 16, 2024
83b0c04
Bump gradle/actions (#3532)
dependabot[bot] Jul 16, 2024
7620eac
Add sentry-android-replay module to craft and readme (#3578)
romtsn Jul 16, 2024
73237da
Check app start spans time and foreground state (#3550)
stefanosiano Jul 17, 2024
391c199
release: 7.12.1
getsentry-bot Jul 23, 2024
60865fe
Bump github/codeql-action from 3.25.11 to 3.25.13 (#3591)
dependabot[bot] Jul 23, 2024
485ff61
Bump reactivecircus/android-emulator-runner from 2.31.0 to 2.32.0 (#3…
dependabot[bot] Jul 23, 2024
74ed0f6
Bump JamesIves/github-pages-deploy-action from 4.6.1 to 4.6.3 (#3590)
dependabot[bot] Jul 23, 2024
a0423a0
Bump gradle/actions (#3597)
dependabot[bot] Jul 23, 2024
fc84053
Bump gradle/wrapper-validation-action from 3.4.2 to 3.5.0 (#3589)
dependabot[bot] Jul 23, 2024
7ee0493
Merge branch 'release/7.12.1'
Jul 25, 2024
3a89243
Bump Spring Boot to 3.3.2 (#3541)
adinauer Jul 29, 2024
e039872
[SR] Capture Replays for ANRs and crashes (#3565)
romtsn Jul 30, 2024
b64477e
release: 7.13.0
getsentry-bot Jul 30, 2024
ae2294f
Merge branch 'release/7.13.0'
Jul 31, 2024
7c34b37
Fix lazy select queries instrumentation (#3604)
stefanosiano Aug 1, 2024
09dab51
Avoid ArrayIndexOutOfBoundsException on Android cpu data collection (…
stefanosiano Aug 1, 2024
d4b1f82
[SR] ANR with buffered Replay integration test (#3612)
romtsn Aug 2, 2024
9486895
[SR] Buffer mode improvements (#3622)
romtsn Aug 9, 2024
19d98e8
[SR] Gesture/touch support for Flutter (#3623)
romtsn Aug 9, 2024
32eed6a
Fix app start spans missing from Pixel devices (#3634)
stefanosiano Aug 12, 2024
f6e97b1
[SR] Fix Session Replay crashes (#3628)
romtsn Aug 12, 2024
65295e4
release: 7.14.0
getsentry-bot Aug 12, 2024
9762f09
Merge branch 'release/7.14.0'
Aug 13, 2024
a22aea0
Verify sentry-android-replay for Google Play SDK Console (#3651)
markushi Aug 29, 2024
014dbef
[SR] Rename errorSampleRate to onErrorSampleRate (#3637)
romtsn Sep 3, 2024
70d1da1
Avoid stopping appStartProfiler after application creation (#3630)
stefanosiano Sep 3, 2024
1aaf7d1
Bump JamesIves/github-pages-deploy-action from 4.6.3 to 4.6.4 (#3681)
dependabot[bot] Sep 9, 2024
8586d1f
Bump github/codeql-action from 3.25.13 to 3.26.6 (#3672)
dependabot[bot] Sep 9, 2024
731ae5a
[SR] Detect dominant color for TextViews with Spans (#3682)
romtsn Sep 11, 2024
9e9e16d
Bump github/codeql-action from 3.26.6 to 3.26.7 (#3692)
dependabot[bot] Sep 16, 2024
80d5908
Bump gradle/actions (#3691)
dependabot[bot] Sep 16, 2024
6368d4f
[SR] Add custom redaction options (#3689)
romtsn Sep 16, 2024
61c8d80
Add support for `feedback` envelope header item type (#3687)
denrase Sep 17, 2024
6c8acb8
Bump github/codeql-action from 3.26.7 to 3.26.8 (#3708)
dependabot[bot] Sep 25, 2024
b11dc55
Ensure app context is used even when SDK is initialized via Activity …
markushi Sep 26, 2024
7e57220
Adds breadcrumb origin field (#3727)
antonis Oct 1, 2024
b5b093e
Replace Calendar.getInstance with System.currentTimeMillis for breadc…
romtsn Oct 3, 2024
955c6ee
chore(readme): Add info about updated release channels (#3773)
kahest Oct 8, 2024
503f916
[QA] Lazily load SentryOptions members (#3749)
romtsn Oct 8, 2024
1607621
[QA] Fix potential ANRs due to default integrations (#3778)
markushi Oct 9, 2024
6548825
[SR] Support Jetpack Compose redaction (#3739)
romtsn Oct 9, 2024
0ab3bb3
[SR] Change terminology from redact/ignore to mask/unmask (#3741)
romtsn Oct 9, 2024
f74af4a
release: 7.15.0
getsentry-bot Oct 9, 2024
fe8ba2c
Merge branch 'release/7.15.0'
Oct 9, 2024
f79c9c1
Deprecate `enableTracing` in v7 (#3777)
adinauer Oct 10, 2024
2ab34eb
[QA] Replace SecureRandom with vendored Random (#3783)
romtsn Oct 14, 2024
a9c767e
[QA] Move NDK scope sync to background thread (#3754)
markushi Oct 14, 2024
6259a9f
[QA] Offload System.loadLibrary call to background thread (#3670)
markushi Oct 14, 2024
9c19319
Add meta option to attach ANR thread dumps (#3791)
markushi Oct 14, 2024
8fdee54
fix invalid profiles when the transaction name is empty (#3747)
stefanosiano Oct 15, 2024
274c295
chore: Add action to warn about potentially risky PR changes (#3726)
kahest Oct 15, 2024
654c2dc
Bump reactivecircus/android-emulator-runner from 2.32.0 to 2.33.0 (#3…
dependabot[bot] Oct 16, 2024
55ea3cc
[QA] Make logging faster on startup (#3793)
romtsn Oct 16, 2024
94071da
[QA] Hardcode integration names (#3794)
romtsn Oct 16, 2024
bd82483
Fix ANRv2 test flakyness (#3798)
stefanosiano Oct 16, 2024
ee6ab95
[QA] Make replay lazy and faster (#3799)
romtsn Oct 16, 2024
31f96ce
Bump codecov/codecov-action from 4.5.0 to 4.6.0 (#3768)
dependabot[bot] Oct 17, 2024
2a8b4fe
Bump github/codeql-action from 3.26.8 to 3.26.12 (#3787)
dependabot[bot] Oct 17, 2024
87bdc75
Bump gradle/actions (#3788)
dependabot[bot] Oct 17, 2024
a8c72dd
Fix ensure ndk libs are loaded before calling close (#3797)
markushi Oct 17, 2024
eb5d294
docs(okhttp): update documented default value to match actual (#3800)
marcin-kozinski Oct 17, 2024
143f91a
Bump JamesIves/github-pages-deploy-action from 4.6.4 to 4.6.8 (#3728)
dependabot[bot] Oct 17, 2024
9182d86
[QA] Cache parsed Dsn (#3796)
stefanosiano Oct 17, 2024
f14a299
release: 7.16.0-alpha.1
getsentry-bot Oct 17, 2024
a9b3fbc
Merge branch 'release/7.16.0-alpha.1'
Oct 17, 2024
0132cdd
[QA] Replace setOf with HashSet.add (#3801)
stefanosiano Oct 17, 2024
0cc9262
[QA] Load lazy fields on init in the background (#3803)
stefanosiano Oct 18, 2024
4988d5b
test(ui): Add critical tests run by Maestro (#3802)
krystofwoldrich Oct 21, 2024
28b6ac9
ci(build): Lower gradle workers to max 2 (#3814)
krystofwoldrich Oct 23, 2024
285450b
Prepare Changelog for 7.16.0 release (#3816)
markushi Oct 23, 2024
95f6443
release: 7.16.0
getsentry-bot Oct 23, 2024
7b3de1d
Merge branch 'release/7.16.0'
Oct 23, 2024
378d12c
Bump github/codeql-action from 3.26.12 to 3.26.13 (#3808)
dependabot[bot] Oct 25, 2024
771d13f
Bump androidx test libraries (#3743)
markushi Oct 28, 2024
92ab1d9
Add callout about `addIntegrationToSdkVersion` breaking change (#3829)
romtsn Oct 28, 2024
283c6cc
Accept manifest integer values when requiring floating values (#3823)
stefanosiano Oct 28, 2024
58da2a3
update benchmark devices on saucelabs (#3822)
stefanosiano Oct 28, 2024
4c5d0ff
Bump reactivecircus/android-emulator-runner from 2.32.0 to 2.33.0 (#3…
dependabot[bot] Oct 28, 2024
c362c98
Bump github/codeql-action from 3.26.13 to 3.27.0 (#3827)
dependabot[bot] Oct 28, 2024
5183da9
test(critical): Add API Level matrix (#3810)
krystofwoldrich Oct 28, 2024
28a11a7
Use `Random` through `ThreadLocal<Random>` (#3835)
adinauer Oct 31, 2024
2af8d1a
Fix: Allow MaxBreadcrumb 0 / Expose MaxBreadcrumb metadata. (#3836)
lucas-zimerman Nov 4, 2024
fd1151b
Bump gradle/actions (#3842)
dependabot[bot] Nov 4, 2024
fba10b8
Limit emulator size to 4096M (#3875)
markushi Nov 12, 2024
566da76
Fix standalone tomcat jndi issue (#3873)
lbloder Nov 12, 2024
4bd1aa3
release: 7.17.0
getsentry-bot Nov 12, 2024
cb0ecf1
Merge branch 'release/7.17.0'
Nov 12, 2024
17a41c1
Ensure android initialization process continues even if options confi…
romtsn Nov 13, 2024
091f84e
Add support for 16KB page sizes (Android 15) (#3620)
markushi Nov 14, 2024
a183163
Do not report parsing ANR error when there are no threads (#3888)
romtsn Nov 14, 2024
dab52e2
[QA] Avoid collecting normal frames (#3782)
stefanosiano Nov 14, 2024
05024c4
Extend CheckInUtils with check-in for a specific environment
maxhov Nov 14, 2024
4a98ac5
Merge branch '8.x.x' into checkinutils-environment
adinauer Nov 18, 2024
49624de
changelog
adinauer Nov 18, 2024
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
Prev Previous commit
Next Next commit
[SR] Buffer mode improvements (#3622)
* Persist buffer replay type when switching to session

* Ensure no gaps in segment timestamps when converting strategies

* Properly store screen name at start for buffer mode

* Changelog
  • Loading branch information
romtsn authored Aug 9, 2024
commit 9486895b563ad8d76e8c09e3a41e74b300bc6554
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Avoid ArrayIndexOutOfBoundsException on Android cpu data collection ([#3598](https://github.com/getsentry/sentry-java/pull/3598))
- Fix lazy select queries instrumentation ([#3604](https://github.com/getsentry/sentry-java/pull/3604))
- Session Replay: buffer mode improvements ([#3622](https://github.com/getsentry/sentry-java/pull/3622))
- Align next segment timestamp with the end of the buffered segment when converting from buffer mode to session mode
- Persist `buffer` replay type for the entire replay when converting from buffer mode to session mode
- Properly store screen names for `buffer` mode

### Chores

Expand Down
5 changes: 3 additions & 2 deletions sentry-android-replay/api/sentry-android-replay.api
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ public abstract interface class io/sentry/android/replay/Recorder : java/io/Clos
public final class io/sentry/android/replay/ReplayCache : java/io/Closeable {
public static final field Companion Lio/sentry/android/replay/ReplayCache$Companion;
public fun <init> (Lio/sentry/SentryOptions;Lio/sentry/protocol/SentryId;Lio/sentry/android/replay/ScreenshotRecorderConfig;)V
public final fun addFrame (Ljava/io/File;J)V
public final fun addFrame (Ljava/io/File;JLjava/lang/String;)V
public static synthetic fun addFrame$default (Lio/sentry/android/replay/ReplayCache;Ljava/io/File;JLjava/lang/String;ILjava/lang/Object;)V
public fun close ()V
public final fun createVideoOf (JJIIILjava/io/File;)Lio/sentry/android/replay/GeneratedVideo;
public static synthetic fun createVideoOf$default (Lio/sentry/android/replay/ReplayCache;JJIIILjava/io/File;ILjava/lang/Object;)Lio/sentry/android/replay/GeneratedVideo;
public final fun persistSegmentValues (Ljava/lang/String;Ljava/lang/String;)V
public final fun rotate (J)V
public final fun rotate (J)Ljava/lang/String;
}

public final class io/sentry/android/replay/ReplayCache$Companion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class ReplayCache(
* @param bitmap the frame screenshot
* @param frameTimestamp the timestamp when the frame screenshot was taken
*/
internal fun addFrame(bitmap: Bitmap, frameTimestamp: Long) {
internal fun addFrame(bitmap: Bitmap, frameTimestamp: Long, screen: String? = null) {
if (replayCacheDir == null || bitmap.isRecycled) {
return
}
Expand All @@ -89,7 +89,7 @@ public class ReplayCache(
it.flush()
}

addFrame(screenshot, frameTimestamp)
addFrame(screenshot, frameTimestamp, screen)
}

/**
Expand All @@ -101,8 +101,8 @@ public class ReplayCache(
* @param screenshot file containing the frame screenshot
* @param frameTimestamp the timestamp when the frame screenshot was taken
*/
public fun addFrame(screenshot: File, frameTimestamp: Long) {
val frame = ReplayFrame(screenshot, frameTimestamp)
public fun addFrame(screenshot: File, frameTimestamp: Long, screen: String? = null) {
val frame = ReplayFrame(screenshot, frameTimestamp, screen)
frames += frame
}

Expand Down Expand Up @@ -233,15 +233,20 @@ public class ReplayCache(
* Removes frames from the in-memory and disk cache from start to [until].
*
* @param until value until whose the frames should be removed, represented as unix timestamp
* @return the first screen in the rotated buffer, if any
*/
fun rotate(until: Long) {
fun rotate(until: Long): String? {
var screen: String? = null
frames.removeAll {
if (it.timestamp < until) {
deleteFile(it.screenshot)
return@removeAll true
} else if (screen == null) {
screen = it.screen
}
return@removeAll false
}
return screen
}

override fun close() {
Expand Down Expand Up @@ -426,7 +431,8 @@ internal data class LastSegmentData(

internal data class ReplayFrame(
val screenshot: File,
val timestamp: Long
val timestamp: Long,
val screen: String? = null
)

public data class GeneratedVideo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import io.sentry.Integration
import io.sentry.NoOpReplayBreadcrumbConverter
import io.sentry.ReplayBreadcrumbConverter
import io.sentry.ReplayController
import io.sentry.ScopeObserverAdapter
import io.sentry.SentryIntegrationPackageStorage
import io.sentry.SentryLevel.DEBUG
import io.sentry.SentryLevel.INFO
Expand All @@ -28,7 +27,6 @@ import io.sentry.cache.PersistingScopeObserver
import io.sentry.cache.PersistingScopeObserver.BREADCRUMBS_FILENAME
import io.sentry.cache.PersistingScopeObserver.REPLAY_FILENAME
import io.sentry.hints.Backfillable
import io.sentry.protocol.Contexts
import io.sentry.protocol.SentryId
import io.sentry.transport.ICurrentDateProvider
import io.sentry.util.FileUtils
Expand Down Expand Up @@ -102,12 +100,6 @@ public class ReplayIntegration(
}

this.hub = hub
this.options.addScopeObserver(object : ScopeObserverAdapter() {
override fun setContexts(contexts: Contexts) {
// scope screen has fully-qualified name
captureStrategy?.onScreenChanged(contexts.app?.viewNames?.lastOrNull()?.substringAfterLast('.'))
}
})
recorder = recorderProvider?.invoke() ?: WindowRecorder(options, this, this, mainLooperHandler)
isEnabled.set(true)

Expand Down Expand Up @@ -176,8 +168,9 @@ public class ReplayIntegration(
return
}

captureStrategy?.captureReplay(isTerminating == true, onSegmentSent = {
captureStrategy?.captureReplay(isTerminating == true, onSegmentSent = { newTimestamp ->
captureStrategy?.currentSegment = captureStrategy?.currentSegment!! + 1
captureStrategy?.segmentTimestamp = newTimestamp
})
captureStrategy = captureStrategy?.convert()
}
Expand Down Expand Up @@ -212,8 +205,10 @@ public class ReplayIntegration(
}

override fun onScreenshotRecorded(bitmap: Bitmap) {
var screen: String? = null
hub?.configureScope { screen = it.screen?.substringAfterLast('.') }
captureStrategy?.onScreenshotRecorded(bitmap) { frameTimeStamp ->
addFrame(bitmap, frameTimeStamp)
addFrame(bitmap, frameTimeStamp, screen)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ internal abstract class BaseCaptureStrategy(
cache?.persistSegmentValues(SEGMENT_KEY_FRAME_RATE, newValue.frameRate.toString())
cache?.persistSegmentValues(SEGMENT_KEY_BIT_RATE, newValue.bitRate.toString())
}
protected var segmentTimestamp by persistableAtomicNullable<Date>(propertyName = SEGMENT_KEY_TIMESTAMP) { _, _, newValue ->
override var segmentTimestamp by persistableAtomicNullable<Date>(propertyName = SEGMENT_KEY_TIMESTAMP) { _, _, newValue ->
cache?.persistSegmentValues(SEGMENT_KEY_TIMESTAMP, if (newValue == null) null else DateUtils.getTimestamp(newValue))
}
protected val replayStartTimestamp = AtomicLong()
Expand All @@ -87,7 +87,7 @@ internal abstract class BaseCaptureStrategy(
override var currentSegment: Int by persistableAtomic(initialValue = -1, propertyName = SEGMENT_KEY_ID)
override val replayCacheDir: File? get() = cache?.replayCacheDir

private var replayType by persistableAtomic<ReplayType>(propertyName = SEGMENT_KEY_REPLAY_TYPE)
override var replayType by persistableAtomic<ReplayType>(propertyName = SEGMENT_KEY_REPLAY_TYPE)
protected val currentEvents: LinkedList<RRWebEvent> = PersistableLinkedList(
propertyName = SEGMENT_KEY_REPLAY_RECORDING,
options,
Expand All @@ -105,15 +105,15 @@ internal abstract class BaseCaptureStrategy(
override fun start(
recorderConfig: ScreenshotRecorderConfig,
segmentId: Int,
replayId: SentryId
replayId: SentryId,
replayType: ReplayType?
) {
cache = replayCacheProvider?.invoke(replayId, recorderConfig) ?: ReplayCache(options, replayId, recorderConfig)

// TODO: this should be persisted even after conversion
replayType = if (this is SessionCaptureStrategy) SESSION else BUFFER
this.replayType = replayType ?: (if (this is SessionCaptureStrategy) SESSION else BUFFER)
this.recorderConfig = recorderConfig
currentSegment = segmentId
currentReplayId = replayId
this.currentSegment = segmentId
this.currentReplayId = replayId

segmentTimestamp = DateUtils.getCurrentDateTime()
replayStartTimestamp.set(dateProvider.currentTimeMillis)
Expand All @@ -140,7 +140,7 @@ internal abstract class BaseCaptureStrategy(
segmentId: Int,
height: Int,
width: Int,
replayType: ReplayType = SESSION,
replayType: ReplayType = this.replayType,
cache: ReplayCache? = this.cache,
frameRate: Int = recorderConfig.frameRate,
screenAtStart: String? = this.screenAtStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import io.sentry.transport.ICurrentDateProvider
import io.sentry.util.FileUtils
import java.io.File
import java.security.SecureRandom
import java.util.Date
import java.util.concurrent.ScheduledExecutorService

internal class BufferCaptureStrategy(
Expand All @@ -34,41 +35,11 @@ internal class BufferCaptureStrategy(
// TODO: capture envelopes for buffered segments instead, but don't send them until buffer is triggered
private val bufferedSegments = mutableListOf<ReplaySegment.Created>()

// TODO: rework this bs, it doesn't work with sending replay on restart
private val bufferedScreensLock = Any()
private val bufferedScreens = mutableListOf<Pair<String, Long>>()

internal companion object {
private const val TAG = "BufferCaptureStrategy"
private const val ENVELOPE_PROCESSING_DELAY: Long = 100L
}

override fun start(
recorderConfig: ScreenshotRecorderConfig,
segmentId: Int,
replayId: SentryId
) {
super.start(recorderConfig, segmentId, replayId)

hub?.configureScope {
val screen = it.screen?.substringAfterLast('.')
if (screen != null) {
synchronized(bufferedScreensLock) {
bufferedScreens.add(screen to dateProvider.currentTimeMillis)
}
}
}
}

override fun onScreenChanged(screen: String?) {
synchronized(bufferedScreensLock) {
val lastKnownScreen = bufferedScreens.lastOrNull()?.first
if (screen != null && lastKnownScreen != screen) {
bufferedScreens.add(screen to dateProvider.currentTimeMillis)
}
}
}

override fun pause() {
createCurrentSegment("pause") { segment ->
if (segment is ReplaySegment.Created) {
Expand All @@ -90,7 +61,7 @@ internal class BufferCaptureStrategy(

override fun captureReplay(
isTerminating: Boolean,
onSegmentSent: () -> Unit
onSegmentSent: (Date) -> Unit
) {
val sampled = random.sample(options.experimental.sessionReplay.errorSampleRate)

Expand Down Expand Up @@ -121,8 +92,7 @@ internal class BufferCaptureStrategy(
// we only want to increment segment_id in the case of success, but currentSegment
// might be irrelevant since we changed strategies, so in the callback we increment
// it on the new strategy already
// TODO: also pass new segmentTimestamp to the new strategy
onSegmentSent()
onSegmentSent(segment.replay.timestamp)
}
}
}
Expand All @@ -136,7 +106,7 @@ internal class BufferCaptureStrategy(

val now = dateProvider.currentTimeMillis
val bufferLimit = now - options.experimental.sessionReplay.errorReplayDuration
cache?.rotate(bufferLimit)
screenAtStart = cache?.rotate(bufferLimit)
bufferedSegments.rotate(bufferLimit)
}
}
Expand All @@ -159,7 +129,7 @@ internal class BufferCaptureStrategy(
}
// we hand over replayExecutor to the new strategy to preserve order of execution
val captureStrategy = SessionCaptureStrategy(options, hub, dateProvider, replayExecutor)
captureStrategy.start(recorderConfig, segmentId = currentSegment, replayId = currentReplayId)
captureStrategy.start(recorderConfig, segmentId = currentSegment, replayId = currentReplayId, replayType = BUFFER)
return captureStrategy
}

Expand All @@ -169,21 +139,6 @@ internal class BufferCaptureStrategy(
rotateEvents(currentEvents, bufferLimit)
}

private fun findAndSetStartScreen(segmentStart: Long) {
synchronized(bufferedScreensLock) {
val startScreen = bufferedScreens.lastOrNull { (_, timestamp) ->
timestamp <= segmentStart
}?.first
// if no screen is found before the segment start, this likely means the buffer is from the
// app start, and the start screen will be taken from the navigation crumbs
if (startScreen != null) {
screenAtStart = startScreen
}
// can clear as we switch to session mode and don't care anymore about buffering
bufferedScreens.clear()
}
}

private fun deleteFile(file: File?) {
if (file == null) {
return
Expand Down Expand Up @@ -246,11 +201,9 @@ internal class BufferCaptureStrategy(
val height = this.recorderConfig.recordingHeight
val width = this.recorderConfig.recordingWidth

findAndSetStartScreen(currentSegmentTimestamp.time)

replayExecutor.submitSafely(options, "$TAG.$taskName") {
val segment =
createSegmentInternal(duration, currentSegmentTimestamp, replayId, segmentId, height, width, BUFFER)
createSegmentInternal(duration, currentSegmentTimestamp, replayId, segmentId, height, width)
onSegmentCreated(segment)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ internal interface CaptureStrategy {
var currentSegment: Int
var currentReplayId: SentryId
val replayCacheDir: File?
var replayType: ReplayType
var segmentTimestamp: Date?

fun start(
recorderConfig: ScreenshotRecorderConfig,
segmentId: Int = 0,
replayId: SentryId = SentryId()
replayId: SentryId = SentryId(),
replayType: ReplayType? = null
)

fun stop()
Expand All @@ -38,7 +41,7 @@ internal interface CaptureStrategy {

fun resume()

fun captureReplay(isTerminating: Boolean, onSegmentSent: () -> Unit)
fun captureReplay(isTerminating: Boolean, onSegmentSent: (Date) -> Unit)

fun onScreenshotRecorded(bitmap: Bitmap? = null, store: ReplayCache.(frameTimestamp: Long) -> Unit)

Expand Down Expand Up @@ -194,7 +197,6 @@ internal interface CaptureStrategy {

replay.urls = urls
return ReplaySegment.Created(
videoDuration = videoDuration,
replay = replay,
recording = recording
)
Expand All @@ -219,7 +221,6 @@ internal interface CaptureStrategy {
sealed class ReplaySegment {
object Failed : ReplaySegment()
data class Created(
val videoDuration: Long,
val replay: SentryReplayEvent,
val recording: ReplayRecording
) : ReplaySegment() {
Expand Down
Loading