diff --git a/CHANGELOG.md b/CHANGELOG.md index e1573c79a1a..1b6484983d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - There were cases where we created options that ended up unused but we failed to clean those up. - No longer log a warning if a logging integration cannot initialize Sentry due to missing DSN ([#5075](https://github.com/getsentry/sentry-java/pull/5075)) - While this may have been useful to some, it caused lots of confusion. +- Session Replay: Add `androidx.camera.view.PreviewView` to default `maskedViewClasses` to mask camera previews by default. ([#5097](https://github.com/getsentry/sentry-java/pull/5097)) ### Dependencies diff --git a/sentry-android-replay/proguard-rules.pro b/sentry-android-replay/proguard-rules.pro index 378c0964f8c..42e3cb30a42 100644 --- a/sentry-android-replay/proguard-rules.pro +++ b/sentry-android-replay/proguard-rules.pro @@ -26,3 +26,6 @@ -keepnames class com.google.android.exoplayer2.ui.PlayerView -dontwarn com.google.android.exoplayer2.ui.StyledPlayerView -keepnames class com.google.android.exoplayer2.ui.StyledPlayerView +# Rules to detect a PreviewView view to later mask it +-dontwarn androidx.camera.view.PreviewView +-keepnames class androidx.camera.view.PreviewView diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt index af30a5b73f7..9982c6623b2 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt @@ -437,6 +437,7 @@ class SessionCaptureStrategyTest { "android.widget.TextView", "android.webkit.WebView", "android.widget.VideoView", + "androidx.camera.view.PreviewView", "androidx.media3.ui.PlayerView", "com.google.android.exoplayer2.ui.PlayerView", "com.google.android.exoplayer2.ui.StyledPlayerView", diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 0a14eaf5ee6..a043f8fe85c 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -3904,6 +3904,7 @@ public final class io/sentry/SentryReplayEvent$ReplayType$Deserializer : io/sent public final class io/sentry/SentryReplayOptions { public static final field ANDROIDX_MEDIA_VIEW_CLASS_NAME Ljava/lang/String; + public static final field CAMERAX_PREVIEW_VIEW_CLASS_NAME Ljava/lang/String; public static final field EXOPLAYER_CLASS_NAME Ljava/lang/String; public static final field EXOPLAYER_STYLED_CLASS_NAME Ljava/lang/String; public static final field IMAGE_VIEW_CLASS_NAME Ljava/lang/String; diff --git a/sentry/src/main/java/io/sentry/SentryReplayOptions.java b/sentry/src/main/java/io/sentry/SentryReplayOptions.java index 23fbe2cb078..cc8733fd824 100644 --- a/sentry/src/main/java/io/sentry/SentryReplayOptions.java +++ b/sentry/src/main/java/io/sentry/SentryReplayOptions.java @@ -25,6 +25,7 @@ public final class SentryReplayOptions { public static final String IMAGE_VIEW_CLASS_NAME = "android.widget.ImageView"; public static final String WEB_VIEW_CLASS_NAME = "android.webkit.WebView"; public static final String VIDEO_VIEW_CLASS_NAME = "android.widget.VideoView"; + public static final String CAMERAX_PREVIEW_VIEW_CLASS_NAME = "androidx.camera.view.PreviewView"; public static final String ANDROIDX_MEDIA_VIEW_CLASS_NAME = "androidx.media3.ui.PlayerView"; public static final String EXOPLAYER_CLASS_NAME = "com.google.android.exoplayer2.ui.PlayerView"; public static final String EXOPLAYER_STYLED_CLASS_NAME = @@ -219,6 +220,7 @@ public SentryReplayOptions(final boolean empty, final @Nullable SdkVersion sdkVe maskViewClasses.add(IMAGE_VIEW_CLASS_NAME); maskViewClasses.add(WEB_VIEW_CLASS_NAME); maskViewClasses.add(VIDEO_VIEW_CLASS_NAME); + maskViewClasses.add(CAMERAX_PREVIEW_VIEW_CLASS_NAME); maskViewClasses.add(ANDROIDX_MEDIA_VIEW_CLASS_NAME); maskViewClasses.add(EXOPLAYER_CLASS_NAME); maskViewClasses.add(EXOPLAYER_STYLED_CLASS_NAME);