Skip to content
Draft
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 @@ -5,6 +5,7 @@
### Fixes

- Prevent concurrent PixelCopy access during Session Replay masking and bitmap cleanup ([#5808](https://github.com/getsentry/sentry-java/pull/5808))
- Reduce Session Replay screenshot memory usage ([#5821](https://github.com/getsentry/sentry-java/pull/5821))
- Backfill release, environment, distribution, tags, and app version/build—and use the matching replay-on-error sample rate—for `ApplicationExitInfo` ANR and native crash events captured before SDK initialization, without reusing options cached by a later app update ([#5762](https://github.com/getsentry/sentry-java/pull/5762))
- `SentryTagModifierNode.isImportantForBounds` now matches the default behavior and returns `true` ([#5789](https://github.com/getsentry/sentry-java/pull/5789))
- Prevent a `StackOverflowError` when a `beforeSend`, `beforeBreadcrumb`, `beforeSendLog`, or `beforeEnvelope` callback triggers another capture (directly or through a logging integration such as Timber) ([#5737](https://github.com/getsentry/sentry-java/pull/5737))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ internal class CanvasStrategy(
Bitmap.createBitmap(
config.recordingWidth,
config.recordingHeight,
Bitmap.Config.ARGB_8888,
Bitmap.Config.RGB_565,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ internal class PixelCopyStrategy(
private val executor = executorProvider.getExecutor()
private val mainLooperHandler = executorProvider.getMainLooperHandler()
private val screenshot =
Bitmap.createBitmap(config.recordingWidth, config.recordingHeight, Bitmap.Config.ARGB_8888)
Bitmap.createBitmap(
config.recordingWidth,
config.recordingHeight,
if (options.sessionReplay.isCaptureSurfaceViews) {
Bitmap.Config.ARGB_8888
} else {
Bitmap.Config.RGB_565
},
)
private val prescaledMatrix by
lazy(NONE) { Matrix().apply { preScale(config.scaleFactorX, config.scaleFactorY) } }
private val lastCaptureSuccessful = AtomicBoolean(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import kotlin.test.assertFalse
import kotlin.test.assertTrue
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.doAnswer
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
Expand Down Expand Up @@ -310,7 +311,9 @@ class PixelCopyStrategyTest {

assertFalse(fixture.contentChangedMarked.get())
assertTrue(strategy.lastCaptureSuccessful())
verify(fixture.callback).onScreenshotRecorded(any<Bitmap>())
val screenshot = argumentCaptor<Bitmap>()
verify(fixture.callback).onScreenshotRecorded(screenshot.capture())
assertEquals(Bitmap.Config.RGB_565, screenshot.firstValue.config)
}

@Test
Expand Down Expand Up @@ -342,7 +345,9 @@ class PixelCopyStrategyTest {
shadowOf(Looper.getMainLooper()).idle()

assertTrue(strategy.lastCaptureSuccessful())
verify(fixture.callback).onScreenshotRecorded(any<Bitmap>())
val screenshot = argumentCaptor<Bitmap>()
verify(fixture.callback).onScreenshotRecorded(screenshot.capture())
assertEquals(Bitmap.Config.ARGB_8888, screenshot.firstValue.config)
}

@Test
Expand Down