Skip to main content
Version: 1.1.x

Privacy Masking - Get Started

Mark UI that displays sensitive content before it can appear in a captured frame. Masking covers visual snapshots and excludes marked sources from built-in Screen Text collection. It does not redact values supplied separately through custom States, Events, API request reports or Screen arguments. Avoid including sensitive values in those APIs separately.

Privacy masks do not redact application logs or diagnostic messages. Keep sensitive values out of logs and exception messages.

Hiding views​

  • XML Views: mask Android Views through the View API.
  • Compose: mask Composables, including hosted Android Views, and set up overscroll tracking.

Compose-specific overscroll tracking and masking examples are covered in the Compose guide.

Padding​

CorynPadding uses dp. Construct it with start, top, end, and bottom, or use all, horizontal, vertical, and symmetric helpers. Negative hiding padding is treated as zero.

Use padding when sensitive pixels extend beyond an element’s layout bounds, for example with custom drawing or visual effects. Overscroll padding is configured separately below.

Moving hidden content​

Coryn masks moving hidden content automatically during scrolling, layout changes and animations. A snapshot may contain masks at several positions of the same element, so a little extra content can be covered during movement.

Manual position changes​

Call Coryn.onHiddenPositionWillChange() only in these cases:

  • Your custom OnPreDrawListener or drawing code moves hidden content to a temporary position for drawing, then restores its original position.
  • You change the elevation or WindowManager.LayoutParams.surfaceInsets of an already attached Popup or Overlay containing hidden Views or Composables.

After Coryn.init, call it on the affected View or window's own UI thread, immediately before each change, including restoring the previous position. Call it directly; do not post it as a separate task.

import ai.coryn.replay.api.core.main.Coryn

// Inside custom drawing code that temporarily moves hidden content:
Coryn.onHiddenPositionWillChange()
hiddenView.translationY = temporaryPosition

// Draw the temporary position, then restore it:
Coryn.onHiddenPositionWillChange()
hiddenView.translationY = originalPosition

Java uses the same method: Coryn.onHiddenPositionWillChange();.

Do not call it for normal scrolling, RecyclerView recycling, layout changes, Compose recomposition, onGloballyPositioned callbacks or ordinary animations. Unnecessary calls skip snapshots and reduce replay updates.

For hidden Composables, use the same notification before either of the manual changes above, on the Compose View's UI thread. Keep enough padding for custom drawing and graphicsLayer transformations; the notification does not replace it.

Overscroll strategy​

Configure overscroll handling directly in the Coryn.startRecording scope:

import ai.coryn.replay.api.core.main.Coryn
import ai.coryn.replay.shared.uicapture.OverscrollStrategy

Coryn.startRecording {
overscrollStrategy = OverscrollStrategy.AdditionalPaddingPercent(5f)
}

Java uses CorynRecordingConfiguration.Builder().setOverscrollStrategy(...). For the singleton strategies, pass OverscrollStrategy.None.INSTANCE or OverscrollStrategy.Reject.INSTANCE.

StrategyBehaviour
AdditionalPaddingPercent(5f)Default. Expand masks by 5% of the affected scroll layer's width horizontally or height vertically, in each possible stretch direction. Nested layers accumulate their directional expansion.
AdditionalPaddingDp(8f)Expand masks by 8 dp in each possible stretch direction. No additional implicit 5% is added.
NoneAdd no overscroll padding. Existing mask bounds and any explicit CorynPadding still apply.
RejectReject captures when overscroll may deform hidden content instead of expanding its masks.

The policy also applies while scrolling is in progress if the SDK detects a risk of overscroll. Padding is directional; it is not added to every side unconditionally. Percentage values use scroll-layer dimensions, not the hidden element's dimensions. Negative dp or percentage values are treated as zero.

Custom EdgeEffect implementations and unsupported Compose effects can cause snapshots to be skipped regardless of padding. Test custom effects with hidden content, or use Reject.

None does not compensate for stretch outside the normal mask bounds. Use it only when overscroll adds no relevant deformation or the explicit hiding padding already covers it.

Custom drawing and graphics-layer transforms

For View drawing through custom effects or shaders, or Composables transformed inside a graphicsLayer { } lambda, supply enough CorynPadding to cover all sensitive pixels. Test masking at the extremes of scrolling, animation, resizing and dialog transitions.

Secure windows​

Android's FLAG_SECURE blocks system screenshots and recording on non-secure displays. It does not exclude a window from Coryn UI Captures or Screen Text. You can keep the flag enabled while recording Session Replay with specific sensitive fields hidden through Coryn's XML View or Compose APIs.

Apply Coryn hiding before displaying sensitive content. Android may still prevent copying platform-protected surface content. For sensitive SurfaceView content, mask its containing View or enclosing Composable and read SurfaceView Capture.