Skip to content

Commit 066f0ab

Browse files
authored
Session Replay: Add PreviewView to default masked view classes (#5097)
* add androidx.camera.view.PreviewView to default masked view classes in SentryReplayOptions * update changelog * add PreviewView to proguard rules * ./gradlew apiDump to restore empty line
1 parent 2c9d584 commit 066f0ab

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- There were cases where we created options that ended up unused but we failed to clean those up.
1414
- 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))
1515
- While this may have been useful to some, it caused lots of confusion.
16+
- 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))
1617

1718
### Dependencies
1819

sentry-android-replay/proguard-rules.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@
2626
-keepnames class com.google.android.exoplayer2.ui.PlayerView
2727
-dontwarn com.google.android.exoplayer2.ui.StyledPlayerView
2828
-keepnames class com.google.android.exoplayer2.ui.StyledPlayerView
29+
# Rules to detect a PreviewView view to later mask it
30+
-dontwarn androidx.camera.view.PreviewView
31+
-keepnames class androidx.camera.view.PreviewView

sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ class SessionCaptureStrategyTest {
437437
"android.widget.TextView",
438438
"android.webkit.WebView",
439439
"android.widget.VideoView",
440+
"androidx.camera.view.PreviewView",
440441
"androidx.media3.ui.PlayerView",
441442
"com.google.android.exoplayer2.ui.PlayerView",
442443
"com.google.android.exoplayer2.ui.StyledPlayerView",

sentry/api/sentry.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3904,6 +3904,7 @@ public final class io/sentry/SentryReplayEvent$ReplayType$Deserializer : io/sent
39043904

39053905
public final class io/sentry/SentryReplayOptions {
39063906
public static final field ANDROIDX_MEDIA_VIEW_CLASS_NAME Ljava/lang/String;
3907+
public static final field CAMERAX_PREVIEW_VIEW_CLASS_NAME Ljava/lang/String;
39073908
public static final field EXOPLAYER_CLASS_NAME Ljava/lang/String;
39083909
public static final field EXOPLAYER_STYLED_CLASS_NAME Ljava/lang/String;
39093910
public static final field IMAGE_VIEW_CLASS_NAME Ljava/lang/String;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public final class SentryReplayOptions {
2525
public static final String IMAGE_VIEW_CLASS_NAME = "android.widget.ImageView";
2626
public static final String WEB_VIEW_CLASS_NAME = "android.webkit.WebView";
2727
public static final String VIDEO_VIEW_CLASS_NAME = "android.widget.VideoView";
28+
public static final String CAMERAX_PREVIEW_VIEW_CLASS_NAME = "androidx.camera.view.PreviewView";
2829
public static final String ANDROIDX_MEDIA_VIEW_CLASS_NAME = "androidx.media3.ui.PlayerView";
2930
public static final String EXOPLAYER_CLASS_NAME = "com.google.android.exoplayer2.ui.PlayerView";
3031
public static final String EXOPLAYER_STYLED_CLASS_NAME =
@@ -219,6 +220,7 @@ public SentryReplayOptions(final boolean empty, final @Nullable SdkVersion sdkVe
219220
maskViewClasses.add(IMAGE_VIEW_CLASS_NAME);
220221
maskViewClasses.add(WEB_VIEW_CLASS_NAME);
221222
maskViewClasses.add(VIDEO_VIEW_CLASS_NAME);
223+
maskViewClasses.add(CAMERAX_PREVIEW_VIEW_CLASS_NAME);
222224
maskViewClasses.add(ANDROIDX_MEDIA_VIEW_CLASS_NAME);
223225
maskViewClasses.add(EXOPLAYER_CLASS_NAME);
224226
maskViewClasses.add(EXOPLAYER_STYLED_CLASS_NAME);

0 commit comments

Comments
 (0)