fix(android): make capture failure and late PixelCopy cleanup safe - #681
Open
OskarEichler wants to merge 2 commits into
Open
fix(android): make capture failure and late PixelCopy cleanup safe#681OskarEichler wants to merge 2 commits into
OskarEichler wants to merge 2 commits into
Conversation
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.
Fixes
Keep PixelCopy callbacks from touching a parent bitmap after timeout, only composite successful copies, return child buffers once copying has finished, preserve interruption, restore TextureView opacity and buffer ownership on failure, close the UI timeout cleanup handoff gap, and remove precreated/partial output files on capture or executor failure. Also remove precreated files when Fabric/legacy UI-block scheduling fails, and ignore parentless release paths instead of throwing.
Compatibility / observable changes
PixelCopy failures and timeouts remain best-effort skipped overlays; there is no new retry or display policy. Encoder/view lookup failures continue rejecting the capture promise. This does not change SurfaceView clipping or pivot transforms covered by existing upstream PRs #656 and #676.
Verification
Compiled actual Java methods exercise success, failed/late callbacks, interrupted waits, request exceptions, texture copy failure, all UI-cleanup interleavings, missing views, executor rejection and delivered-file preservation. No claim of physical-device PixelCopy/video rendering coverage. Seven additional compiled actual module checks cover both scheduling paths, root-path release, normal file release, inline results and successful scheduling.
This patch was applied independently to upstream commit
6acbec50a5e3cab7d668711d757c52cfdc791c76and passed its targeted external actual-source diagnostics. Across the focused patches, 119 such checks pass. Java/Objective-C diagnostics use controlled bridge/platform doubles or owned filesystem fixtures; they are not substitutes for physical-device rendering tests.Combined branch checks:
The separate iOS cleanup patch intentionally makes the existing test named
testReleaseCapture_currentlyDeletesPrefixOnlyImposterDirectories_KNOWN_LOOSE_GUARDfail because it asserts the unsafe old behavior. That patch is kept in a separate draft PR. No checked-in test/spec or snapshot files were added, modified, regenerated or disabled.Windows/Expo native builds, physical-device video/PixelCopy output, and full Detox suites were not run. The full unchanged Playwright suite was run against both baseline and patched builds: both have 9 passes and the same 3 failures. Two Linux-reference screenshot mismatches have byte-identical baseline/patched actual images on macOS. The CORS fixture hard-codes port 3000, occupied by an unrelated local backend; the isolated example uses another port. No snapshots or assertions were changed. React Doctor also reports existing example suggestions and a React-18 ref-cleanup warning; the latter was checked against actual React 18 legacy-ref and React 19 cleanup behavior. No rules were suppressed.
Scope
android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.javaandroid/src/main/java/fr/greweb/reactnativeviewshot/RNViewShotModule.javaUnrelated audit changes are submitted separately.