Skip to content

Conversation

@romtsn
Copy link
Member

@romtsn romtsn commented Jul 30, 2025

<pr_request_template>## 📜 Description
Ensured that only one screen capture loop is active at a time by removing existing Capturer callbacks before scheduling new ones in onConfigurationChanged and Capturer.resume().

💡 Motivation and Context

The onConfigurationChanged and Capturer.resume() methods were causing multiple concurrent screen capture loops. This occurred because they would schedule or re-post the Capturer runnable via mainLooperHandler without first removing any existing or previously scheduled callbacks. This led to redundant capture attempts and potential performance issues. The fix prevents this by clearing previous callbacks before posting new ones.

💚 How did you test it?

The fix was implemented based on code analysis to prevent redundant callback scheduling.

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps</pr_request_template>


Open in Cursor Open in Web

Learn more about Cursor Agents

Co-authored-by: roman.zavarnitsyn <roman.zavarnitsyn@sentry.io>
@github-actions
Copy link
Contributor

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Prevent duplicate screen capture loops ([#4580](https://github.com/getsentry/sentry-java/pull/4580))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against bdd9dca

@romtsn romtsn closed this Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants