Skip to content

Commit 2b8e4aa

Browse files
romtsnclaude
andcommitted
fix: Resolve merge conflicts with main and integrate trackCustomMasking
Move trackCustomMasking() to SentryMaskingOptions as an abstract method so it can be called polymorphically from replay view hierarchy code. SentryReplayOptions provides the real implementation, while SentryScreenshotOptions provides a no-op. Also adds CAMERAX_PREVIEW_VIEW_CLASS_NAME to SentryMaskingOptions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b26b448 commit 2b8e4aa

File tree

7 files changed

+21
-5
lines changed

7 files changed

+21
-5
lines changed

sentry-android-core/api/sentry-android-core.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ public final class io/sentry/android/core/SentryPerformanceProvider {
455455
public final class io/sentry/android/core/SentryScreenshotOptions : io/sentry/SentryMaskingOptions {
456456
public fun <init> ()V
457457
public fun setMaskAllImages (Z)V
458+
public fun trackCustomMasking ()V
458459
}
459460

460461
public class io/sentry/android/core/SentryUserFeedbackButton : android/widget/Button {

sentry-android-core/src/main/java/io/sentry/android/core/SentryScreenshotOptions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public SentryScreenshotOptions() {
1919
// maskViewClasses starts empty, so nothing is masked by default.
2020
}
2121

22+
@Override
23+
public void trackCustomMasking() {
24+
// No-op for screenshots, custom masking tracking is only relevant for session replay.
25+
}
26+
2227
/**
2328
* {@inheritDoc}
2429
*

sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ internal object ComposeViewHierarchyNode {
8585
): Boolean {
8686
val sentryPrivacyModifier = this?.getOrNull(SentryReplayModifiers.SentryPrivacy)
8787
if (sentryPrivacyModifier == "unmask") {
88-
options.sessionReplay.trackCustomMasking()
88+
options.trackCustomMasking()
8989
return false
9090
}
9191

9292
if (sentryPrivacyModifier == "mask") {
93-
options.sessionReplay.trackCustomMasking()
93+
options.trackCustomMasking()
9494
return true
9595
}
9696

sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,15 @@ internal sealed class ViewHierarchyNode(
291291
(tag as? String)?.lowercase()?.contains(SENTRY_UNMASK_TAG) == true ||
292292
getTag(R.id.sentry_privacy) == "unmask"
293293
) {
294-
options.sessionReplay.trackCustomMasking()
294+
options.trackCustomMasking()
295295
return false
296296
}
297297

298298
if (
299299
(tag as? String)?.lowercase()?.contains(SENTRY_MASK_TAG) == true ||
300300
getTag(R.id.sentry_privacy) == "mask"
301301
) {
302-
options.sessionReplay.trackCustomMasking()
302+
options.trackCustomMasking()
303303
return true
304304
}
305305

sentry/api/sentry.api

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3368,6 +3368,7 @@ public abstract class io/sentry/SentryMaskingOptions {
33683368
public fun setMaskAllText (Z)V
33693369
public fun setMaskViewContainerClass (Ljava/lang/String;)V
33703370
public fun setUnmaskViewContainerClass (Ljava/lang/String;)V
3371+
public abstract fun trackCustomMasking ()V
33713372
}
33723373

33733374
public final class io/sentry/SentryMetricsEvent : io/sentry/JsonSerializable, io/sentry/JsonUnknown {
@@ -3928,6 +3929,8 @@ public final class io/sentry/SentryReplayOptions : io/sentry/SentryMaskingOption
39283929
public static final field MAX_NETWORK_BODY_SIZE I
39293930
public fun <init> (Ljava/lang/Double;Ljava/lang/Double;Lio/sentry/protocol/SdkVersion;)V
39303931
public fun <init> (ZLio/sentry/protocol/SdkVersion;)V
3932+
public fun addMaskViewClass (Ljava/lang/String;)V
3933+
public fun addUnmaskViewClass (Ljava/lang/String;)V
39313934
public fun getErrorReplayDuration ()J
39323935
public fun getFrameRate ()I
39333936
public fun getNetworkDetailAllowUrls ()Ljava/util/List;
@@ -3948,6 +3951,8 @@ public final class io/sentry/SentryReplayOptions : io/sentry/SentryMaskingOption
39483951
public fun isSessionReplayForErrorsEnabled ()Z
39493952
public fun isTrackConfiguration ()Z
39503953
public fun setDebug (Z)V
3954+
public fun setMaskAllImages (Z)V
3955+
public fun setMaskAllText (Z)V
39513956
public fun setNetworkCaptureBodies (Z)V
39523957
public fun setNetworkDetailAllowUrls (Ljava/util/List;)V
39533958
public fun setNetworkDetailDenyUrls (Ljava/util/List;)V

sentry/src/main/java/io/sentry/SentryMaskingOptions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.Set;
44
import java.util.concurrent.CopyOnWriteArraySet;
5+
import org.jetbrains.annotations.ApiStatus;
56
import org.jetbrains.annotations.NotNull;
67
import org.jetbrains.annotations.Nullable;
78

@@ -119,4 +120,8 @@ public void setMaskViewContainerClass(@NotNull String containerClass) {
119120
public void setUnmaskViewContainerClass(@NotNull String containerClass) {
120121
unmaskViewContainerClass = containerClass;
121122
}
123+
124+
/** Hook for subclasses to track custom masking usage. */
125+
@ApiStatus.Internal
126+
public abstract void trackCustomMasking();
122127
}

sentry/src/main/java/io/sentry/SentryReplayOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public long getSessionDuration() {
297297
return sessionDuration;
298298
}
299299

300-
@ApiStatus.Internal
300+
@Override
301301
public void trackCustomMasking() {
302302
if (!customMaskingTracked) {
303303
customMaskingTracked = true;

0 commit comments

Comments
 (0)