2323import io .sentry .util .Objects ;
2424import java .util .concurrent .CountDownLatch ;
2525import java .util .concurrent .TimeUnit ;
26+ import java .util .concurrent .atomic .AtomicBoolean ;
2627import java .util .concurrent .atomic .AtomicReference ;
2728import org .jetbrains .annotations .ApiStatus ;
2829import org .jetbrains .annotations .NotNull ;
@@ -44,6 +45,7 @@ public final class ScreenshotEventProcessor implements EventProcessor {
4445 private static final long MASKING_TIMEOUT_MS = 2000 ;
4546
4647 private final boolean isReplayAvailable ;
48+ private final AtomicBoolean isReplayModuleAbsenceLogged = new AtomicBoolean (false );
4749
4850 public ScreenshotEventProcessor (
4951 final @ NotNull SentryAndroidOptions options ,
@@ -62,11 +64,6 @@ public ScreenshotEventProcessor(
6264
6365 if (options .isAttachScreenshot ()) {
6466 addIntegrationToSdkVersion ("Screenshot" );
65- if (!isReplayAvailable && !options .getScreenshot ().getMaskViewClasses ().isEmpty ()) {
66- options
67- .getLogger ()
68- .log (SentryLevel .WARNING , "Screenshot masking requires sentry-android-replay module" );
69- }
7067 }
7168 }
7269
@@ -93,6 +90,15 @@ private boolean isMaskingEnabled() {
9390
9491 return event ;
9592 }
93+ if (!isReplayAvailable && !options .getScreenshot ().getMaskViewClasses ().isEmpty ()) {
94+ if (!isReplayModuleAbsenceLogged .getAndSet (true )) {
95+ options
96+ .getLogger ()
97+ .log (SentryLevel .WARNING , "Screenshot masking requires sentry-android-replay module" );
98+ }
99+ return event ;
100+ }
101+
96102 final @ Nullable Activity activity = CurrentActivityHolder .getInstance ().getActivity ();
97103 if (activity == null || HintUtils .isFromHybridSdk (hint )) {
98104 return event ;
0 commit comments