Skip to content

Reproduction for sentry-java#4400#18

Closed
romtsn wants to merge 1 commit intomainfrom
repro/sentry-java-4400
Closed

Reproduction for sentry-java#4400#18
romtsn wants to merge 1 commit intomainfrom
repro/sentry-java-4400

Conversation

@romtsn
Copy link
Member

@romtsn romtsn commented Jan 30, 2026

Summary

Reproduces the issue where CameraX PreviewView content may not be properly masked in Sentry Session Replay.

Test Instructions

  1. Set your Sentry DSN: export SENTRY_DSN="your-dsn-here"
  2. Build and install: ./gradlew installDebug
  3. Run on a physical device and grant camera permission
  4. Tap "Capture Error" or "Trigger Fatal Crash" while camera is showing
  5. Check Sentry replay to see if camera content is masked

Expected vs Actual

  • Expected: Camera preview should be masked/blacked out in replay
  • Actual (reported): Camera content may be visible in replay

🤖 Generated with Claude Code

Reproduces the issue where CameraX PreviewView content may not be properly masked in Sentry Session Replay.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.


SentryAndroid.init(this) { options ->
// Set your DSN or use environment variable SENTRY_DSN
options.dsn = System.getenv("SENTRY_DSN") ?: ""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment variable retrieval won't work on Android

High Severity

System.getenv("SENTRY_DSN") will always return null on Android devices because apps run in isolated processes that don't inherit the build machine's shell environment. The README instructs users to export SENTRY_DSN=... before building, but this env var won't be accessible at runtime. The DSN will always be empty, preventing Sentry from capturing any replays and rendering this reproduction project non-functional.

Fix in Cursor Fix in Web

binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

cameraExecutor = Executors.newSingleThreadExecutor()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused cameraExecutor creates unnecessary thread pool

Low Severity

The cameraExecutor is declared and initialized as a single-thread executor but is never actually used. The camera provider listener at line 111 uses ContextCompat.getMainExecutor(this) instead. This results in an unnecessary thread pool allocation that only gets shut down in onDestroy().

Additional Locations (1)

Fix in Cursor Fix in Web

val cameraProviderFuture = ProcessCameraProvider.getInstance(this)

cameraProviderFuture.addListener({
val cameraProvider = cameraProviderFuture.get()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unhandled exception from camera provider initialization

Low Severity

The cameraProviderFuture.get() call is outside the try-catch block that handles camera errors. If ProcessCameraProvider initialization fails (e.g., on emulators, devices with camera issues, or unusual configurations), this throws an uncaught ExecutionException that crashes the app without being logged to Sentry. The try-catch only covers unbindAll() and bindToLifecycle(), missing this earlier failure point.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants