Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[camera] Avoid joining thread causing ANR #6224

Merged
merged 8 commits into from
Sep 4, 2022

Conversation

camsim99
Copy link
Contributor

@camsim99 camsim99 commented Aug 10, 2022

Addresses flutter/flutter#106493. Stops calling join on the background HandlerThread since it is not needed for any thread synchronization and quitSafely is used to ensure any outstanding messages are delivered.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@camsim99 camsim99 changed the title Avoid joining thread causing ANR [camera] Avoid joining thread causing ANR Aug 10, 2022
@camsim99 camsim99 marked this pull request as ready for review August 12, 2022 23:18
@@ -677,11 +677,6 @@ public void stopBackgroundThread() {
if (backgroundHandlerThread != null) {
stoppingBackgroundHandlerThread = true;
backgroundHandlerThread.quitSafely();
try {
backgroundHandlerThread.join();
Copy link
Contributor

Choose a reason for hiding this comment

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

What does stoppingBackgroundHandlerThread do without this join? Presumably from the description quitSafely is asynchronous, so it looks like we're now setting it to true and then back to false within the same execution cycle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh you're right. I think I added that not knowing it was acting as a bandaid for the real problem!

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

LGTM with versioning nit.

@@ -1,3 +1,7 @@
## 0.10.1
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this should be 0.10.1+2 since it's a bugfix to a <1.0 package.

@tinyc0der
Copy link
Contributor

Is it release yet?

@stuartmorgan
Copy link
Contributor

Yes, changes to our packages are generally published immediately.

adam-harwood pushed a commit to adam-harwood/flutter_plugins that referenced this pull request Nov 3, 2022
mauricioluz pushed a commit to mauricioluz/plugins that referenced this pull request Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: camera platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants