Skip to content

Commit

Permalink
Merge pull request #2321 from DataDog/jmoskovich/fgm-proguard-rules
Browse files Browse the repository at this point in the history
Prevent obfuscation of Fine Grained Masking enums
  • Loading branch information
jonathanmos authored Oct 15, 2024
2 parents ca952c5 + 2d03936 commit 0014ced
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 9 deletions.
7 changes: 4 additions & 3 deletions features/dd-sdk-android-session-replay/api/apiSurface
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
interface com.datadog.android.sessionreplay.ExtensionSupport
fun getCustomViewMappers(): List<MapperTypeWrapper<*>>
fun getOptionSelectorDetectors(): List<com.datadog.android.sessionreplay.recorder.OptionSelectorDetector>
enum com.datadog.android.sessionreplay.ImagePrivacy
enum com.datadog.android.sessionreplay.ImagePrivacy : PrivacyLevel
- MASK_NONE
- MASK_LARGE_ONLY
- MASK_ALL
data class com.datadog.android.sessionreplay.MapperTypeWrapper<T: android.view.View>
constructor(Class<T>, com.datadog.android.sessionreplay.recorder.mapper.WireframeMapper<T>)
fun supportsView(android.view.View): Boolean
fun getUnsafeMapper(): com.datadog.android.sessionreplay.recorder.mapper.WireframeMapper<android.view.View>
interface com.datadog.android.sessionreplay.PrivacyLevel
fun android.view.View.setSessionReplayHidden(Boolean)
fun android.view.View.setSessionReplayImagePrivacy(ImagePrivacy?)
fun android.view.View.setSessionReplayTextAndInputPrivacy(TextAndInputPrivacy?)
Expand Down Expand Up @@ -41,11 +42,11 @@ class com.datadog.android.sessionreplay.SystemRequirementsConfiguration
companion object
val BASIC: SystemRequirementsConfiguration
val NONE: SystemRequirementsConfiguration
enum com.datadog.android.sessionreplay.TextAndInputPrivacy
enum com.datadog.android.sessionreplay.TextAndInputPrivacy : PrivacyLevel
- MASK_SENSITIVE_INPUTS
- MASK_ALL_INPUTS
- MASK_ALL
enum com.datadog.android.sessionreplay.TouchPrivacy
enum com.datadog.android.sessionreplay.TouchPrivacy : PrivacyLevel
- SHOW
- HIDE
data class com.datadog.android.sessionreplay.recorder.MappingContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ public abstract interface class com/datadog/android/sessionreplay/ExtensionSuppo
public abstract fun getOptionSelectorDetectors ()Ljava/util/List;
}

public final class com/datadog/android/sessionreplay/ImagePrivacy : java/lang/Enum {
public final class com/datadog/android/sessionreplay/ImagePrivacy : java/lang/Enum, com/datadog/android/sessionreplay/PrivacyLevel {
public static final field MASK_ALL Lcom/datadog/android/sessionreplay/ImagePrivacy;
public static final field MASK_LARGE_ONLY Lcom/datadog/android/sessionreplay/ImagePrivacy;
public static final field MASK_NONE Lcom/datadog/android/sessionreplay/ImagePrivacy;
Expand All @@ -22,6 +22,9 @@ public final class com/datadog/android/sessionreplay/MapperTypeWrapper {
public fun toString ()Ljava/lang/String;
}

public abstract interface class com/datadog/android/sessionreplay/PrivacyLevel {
}

public final class com/datadog/android/sessionreplay/PrivacyOverrideExtensionsKt {
public static final fun setSessionReplayHidden (Landroid/view/View;Z)V
public static final fun setSessionReplayImagePrivacy (Landroid/view/View;Lcom/datadog/android/sessionreplay/ImagePrivacy;)V
Expand Down Expand Up @@ -85,15 +88,15 @@ public final class com/datadog/android/sessionreplay/SystemRequirementsConfigura
public final fun getNONE ()Lcom/datadog/android/sessionreplay/SystemRequirementsConfiguration;
}

public final class com/datadog/android/sessionreplay/TextAndInputPrivacy : java/lang/Enum {
public final class com/datadog/android/sessionreplay/TextAndInputPrivacy : java/lang/Enum, com/datadog/android/sessionreplay/PrivacyLevel {
public static final field MASK_ALL Lcom/datadog/android/sessionreplay/TextAndInputPrivacy;
public static final field MASK_ALL_INPUTS Lcom/datadog/android/sessionreplay/TextAndInputPrivacy;
public static final field MASK_SENSITIVE_INPUTS Lcom/datadog/android/sessionreplay/TextAndInputPrivacy;
public static fun valueOf (Ljava/lang/String;)Lcom/datadog/android/sessionreplay/TextAndInputPrivacy;
public static fun values ()[Lcom/datadog/android/sessionreplay/TextAndInputPrivacy;
}

public final class com/datadog/android/sessionreplay/TouchPrivacy : java/lang/Enum {
public final class com/datadog/android/sessionreplay/TouchPrivacy : java/lang/Enum, com/datadog/android/sessionreplay/PrivacyLevel {
public static final field HIDE Lcom/datadog/android/sessionreplay/TouchPrivacy;
public static final field SHOW Lcom/datadog/android/sessionreplay/TouchPrivacy;
public static fun valueOf (Ljava/lang/String;)Lcom/datadog/android/sessionreplay/TouchPrivacy;
Expand Down
3 changes: 3 additions & 0 deletions features/dd-sdk-android-session-replay/consumer-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
-keepnames class com.datadog.android.sessionreplay.internal.recorder.listener.WindowsOnDrawListener
-keepnames class * extends com.datadog.android.sessionreplay.recorder.mapper.WireframeMapper
-keepnames class * extends com.datadog.android.sessionreplay.internal.async.RecordedDataQueueItem

# Keep the fine grained masking level enums
-keepnames enum * extends com.datadog.android.sessionreplay.PrivacyLevel { *; }
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package com.datadog.android.sessionreplay
* @see ImagePrivacy.MASK_LARGE_ONLY
* @see ImagePrivacy.MASK_ALL
*/
enum class ImagePrivacy {
enum class ImagePrivacy : PrivacyLevel {
/**
* All images will be recorded, including those downloaded from the Internet during app runtime.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2016-Present Datadog, Inc.
*/

package com.datadog.android.sessionreplay

/**
* Base interface for privacy masking levels.
*/
interface PrivacyLevel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package com.datadog.android.sessionreplay
* @see TextAndInputPrivacy.MASK_ALL_INPUTS
* @see TextAndInputPrivacy.MASK_ALL
*/
enum class TextAndInputPrivacy {
enum class TextAndInputPrivacy : PrivacyLevel {

/**
* All text and inputs considered sensitive will be masked.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package com.datadog.android.sessionreplay
* @see TouchPrivacy.SHOW
* @see TouchPrivacy.HIDE
*/
enum class TouchPrivacy {
enum class TouchPrivacy : PrivacyLevel {
/**
* All touch interactions will be recorded.
*/
Expand Down

0 comments on commit 0014ced

Please sign in to comment.