Repository navigation
Reuse and close Android barcode scanners without leaking shared images - #813
Open
zack-dev-cm wants to merge 1 commit into
Open
zack-dev-cm wants to merge 1 commit into
zack-dev-cm wants to merge 1 commit into
Conversation
This was referenced Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #811. The Android analyzer creates an ML Kit scanner for every frame without closing it. The shared barcode/face callback can also leave an image open when a consumer throws synchronously. Both defects reproduce in the original native implementation; a standard-template reproducer uses published version 18.0.1.
Give each barcode analyzer one lazy scanner and an explicit close lifecycle. Rebinding or detaching closes it after outstanding work settles; closed analyzers suppress late events. Launch both shared-image consumers even if one throws synchronously, then close the image exactly once after all launched tasks finish. Public constructors, analysis entry points, inference frequency and event throttling are preserved.
This PR starts independently from upstream. Coordinate mapping is in #812, executor reattachment in #817, and CI toolchain drift in #816.
How did you test this change?
Independent head
81914f5, based ona2a81ce:The four-PR merge guide identifies the overlapping files and the exact resolution at
7ffe27b. Its public validation passes 41 Robolectric tests with zero skips, TypeScript, ESLint and installed Debug AAR builds in both architectures; per-suite summaries and artifacts are available.Upstream workflows await approval. Synthetic lifecycle tests do not establish physical-camera memory, battery or performance improvements. The simulator checks exercise navigation. The baseline default-Xcode build failure is addressed separately in #816.