Handle Sensitive Data

To protect user privacy during session recordings, configure Session Replay to mask sensitive data by enabling options that obscure all text and input fields by default.

Rendering Modes

You can choose any of the following rendering modes to create session recordings. By default, Session Replay uses the Native mode.
ModeDescription
RenderingMode.NATIVERegularly captures the app screen which the Session Replay immediately processes to remove sensitive data. The frames are then complied to make the session recording.
RenderingMode.WIREFRAMECaptures the app using only a wireframe representation of the screen data. No user data is recorded. This is the preferred rendering method for user data security.

Set the Rendering Mode

Configure the agent with the following code to set the rendering mode:
import com.appdynamics.eumagent.runtime.Instrumentation;
...
@Override public void onCreate(Bundle savedInstanceState) {
  Instrumentation.start(AgentConfiguration.builder()
    .withAppKey("<EUM_APP_KEY>")
    .withContext(getApplicationContext())
    // The default SaaS EUM Server and Screenshot Service are in the Americas,
    // so you can omit the following settings if you are in the Americas.
    .withSessionReplayEnabled.withSensitivity(true)
    .withBlobServiceURL(configHelper.getSessionReplayUrl()) 
    .build());
  ...
} 

Read the Rendering Mode

Configure the agent with the following code to read the rendering mode:
import com.appdynamics.eumagent.runtime.Instrumentation;
...
@Override public void onCreate(Bundle savedInstanceState) {
  Instrumentation.start(AgentConfiguration.builder()
    .withAppKey("<EUM_APP_KEY>")
    .withContext(getApplicationContext())
    // The default SaaS EUM Server and Screenshot Service are in the Americas,
    // so you can omit the following settings if you are in the Americas.
    .withSessionReplayEnabled.withSensitivity(true)
    .withBlobServiceURL(<Session Replay URL>) 
    .build());
  ...
} 

Sensitivity

You can set sensitivity on elements in your project. Based on how you built your app, choose one of the following:

View Sensitivity

Set sensitivity to any View instance using the following code:
Instrumentation.setViewSensitivity(<VIEW>, true);
Read sensitivity to any View instance using the following code:
Boolean editTextSensitivity = Instrumentation.getViewSensitivity(<VIEW>);

Class Sensitivity

Set the sensitivity to all instances of a Class that extends a View rather than setting the sensitivity on a specific View:
Instrumentation.setClassSensitivity(<CLASS>.class, true);
Read the sensitivity to all instances of a Class that extends a View rather than setting the sensitivity on a specific View:
Instrumentation.getClassSensitivity(<CLASS>.class)

Recording Masks

Recording Masks Example

In cases where areas of the app shouldn't be recorded, but cannot be defined by a view, you can use RecordingMask:

Session Replay masks either by covering or erasing the sensitive data. Use the following configuration to set the recording masks:

Instrumentation.setRecordingMask(<Map of Masks>);  

You can only have one Recording mask set at a time, but the recording mask can contain a list of MaskType to cover multiple areas at once. Use the following mask types to protect sensitive data:

Mask TypeHow it Works?
MaskType.MASK_TYPE_COVERINGThe area defined by the element Rect is not recorded
MaskType.MASK_TYPE_ERASINGThe area defined by the element Rect is recorded even if a previous MaskType. inside a list was covering the area.
The following is an example to mask sensitive data:
Map<Rect, Integer> maskMap = new HashMap<>();
                
                // Large covering mask for entire toolbar area
                Rect toolbarArea = new Rect(0, 0, 1080, 400);
                maskMap.put(toolbarArea, MaskType.MASK_TYPE_COVERING);
                
                // Erasing mask to reveal specific button area
                Rect buttonRevealArea = new Rect(800, 50, 1000, 200);
                maskMap.put(buttonRevealArea, MaskType.MASK_TYPE_ERASING);
                
                // Another covering mask for sensitive content area
                Rect sensitiveArea = new Rect(100, 500, 900, 700);
                maskMap.put(sensitiveArea, MaskType.MASK_TYPE_COVERING);
                
                Instrumentation.setRecordingMask(maskMap);  
Use the following code to read the recording masks:
Map<Rect, Integer> currentMasks = Instrumentation.getRecordingMask();