diff --git a/docs/platforms/android/session-replay/index.mdx b/docs/platforms/android/session-replay/index.mdx index 153d5704836b1..bc15b8cdae896 100644 --- a/docs/platforms/android/session-replay/index.mdx +++ b/docs/platforms/android/session-replay/index.mdx @@ -57,12 +57,22 @@ SentryAndroid.init(context) { options -> options.sessionReplay.onErrorSampleRate = 1.0 options.sessionReplay.sessionSampleRate = 0.1 + + // if your application has strict PII requirements we recommend using the Canvas screenshot strategy + // Note: this strategy is experimental and does **not** support any masking options, it always masks text and images + // Available in the Android SDK version 8.24.0 or above + // options.sessionReplay.screenshotStrategy = ScreenshotStrategyType.CANVAS } ``` ```XML {filename:AndroidManifest.xml} + + + + + ``` ## Verify @@ -117,6 +127,32 @@ options.sessionReplay.maskAllImages = false ``` +### Screenshot Strategy + +The SDK offers two strategies for recording replays: `PixelCopy` and `Canvas`. + +`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. + +`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. + + + +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`. + + + +You can change the strategy as follows: + +```kotlin +import io.sentry.ScreenshotStrategyType + +options.sessionReplay.screenshotStrategy = ScreenshotStrategyType.CANVAS // or ScreenshotStrategyType.PIXEL_COPY (default) +``` + +```XML {filename:AndroidManifest.xml} + +``` + ## Error Linking 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: diff --git a/docs/platforms/android/session-replay/privacy/index.mdx b/docs/platforms/android/session-replay/privacy/index.mdx index c301f3a0cabf2..627b909763e33 100644 --- a/docs/platforms/android/session-replay/privacy/index.mdx +++ b/docs/platforms/android/session-replay/privacy/index.mdx @@ -7,6 +7,12 @@ description: "Learn how to mask parts of your app's data in Session Replay." +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. + + + + + 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.