You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(android): Add screenshot strategy to session replay docs (#15270)
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
- Add a new option `screenshotStrategy` which has been introduced in
this [PR](getsentry/sentry-java#4777) and allows
customers to specify a more reliable masking strategy.
## IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [x] Other deadline: Ideally next week
- [ ] None: Not urgent, can wait up to 1 week+
The SDK offers two strategies for recording replays: `PixelCopy` and `Canvas`.
133
+
134
+
`PixelCopy` uses Android's [PixelCopy](https://developer.android.com/reference/android/view/PixelCopy) API to capture screenshots of the current screen and takes a snapshot of the view hierarchy within the same frame. The view hierarchy is then used to find the position of controls such as text boxes, images, labels, and buttons and mask them with a block that's drawn over these controls. This strategy has slightly lower performance overhead but may result in masking misalignments due to the asynchronous nature of the PixelCopy API. We recommend using this strategy for apps that do not have strict PII requirements or do not require masking functionality.
135
+
136
+
`Canvas` uses Android's custom [Canvas](https://developer.android.com/reference/android/graphics/Canvas) API to redraw the screen contents onto a bitmap, masking all `drawText` and `drawBitmap` operations in the process to produce a masked screenshot. This strategy has a slightly higher performance overhead but provides more reliable masking. We recommend using this strategy for apps with strict PII requirements.
137
+
138
+
<Alertlevel="warning">
139
+
140
+
The `Canvas` screenshot strategy is currently experimental and does **not** support any masking options. When the screenshot strategy is set to `Canvas`, it will **always** mask all texts, input fields and images, disregarding any masking options set. If you need more flexibility with masking, switch back to `PixelCopy`.
141
+
142
+
</Alert>
143
+
144
+
You can change the strategy as follows:
145
+
146
+
```kotlin
147
+
importio.sentry.ScreenshotStrategyType
148
+
149
+
options.sessionReplay.screenshotStrategy =ScreenshotStrategyType.CANVAS// or ScreenshotStrategyType.PIXEL_COPY (default)
Errors that happen while a replay is running will be linked to the replay, making it possible to jump between related issues and replays. However, it's **possible** that in some cases the error count reported on the **Replays Details** page won't match the actual errors that have been captured. That's because errors can be lost, and while this is uncommon, there are a few reasons why it could happen:
Copy file name to clipboardExpand all lines: docs/platforms/android/session-replay/privacy/index.mdx
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,12 @@ description: "Learn how to mask parts of your app's data in Session Replay."
7
7
8
8
<Alertlevel="warning">
9
9
10
+
The masking options below only apply when using the default `PixelCopy` strategy. If you set the strategy to [Canvas](/platforms/android/session-replay/#screenshot-strategy), those options will be ignored and all sensitive content (texts, inputs, images) will be **always** masked.
11
+
12
+
</Alert>
13
+
14
+
<Alertlevel="warning">
15
+
10
16
Before enabling Session Replay in production, verify your masking configuration to ensure no sensitive data is captured. Our default settings aggressively mask potentially sensitive data, but if you modify these settings or update UI frameworks or system SDKs, you must thoroughly test your application. If you find any masking issues or sensitive data that should be masked but isn't, please [create a GitHub issue](https://github.com/getsentry/sentry-java/issues/new/choose) and avoid deploying to production with Session Replay enabled until the issue is resolved.
0 commit comments