Skip to content

fix(Android): close temporary image and theme resources - #8361

Open
OskarEichler wants to merge 1 commit into
wix:masterfrom
OskarEichler:codex/close-android-temporary-resources
Open

fix(Android): close temporary image and theme resources#8361
OskarEichler wants to merge 1 commit into
wix:masterfrom
OskarEichler:codex/close-android-temporary-resources

Conversation

@OskarEichler

Copy link
Copy Markdown

Problems and fixes

The Android resource-lifecycle sweep found two temporary resources that were never closed:

  • Dev image loading passed an opened local/network InputStream to BitmapFactory without closing it. If opening or decoding threw, the temporary permissive StrictMode policy also remained installed on the calling thread.
  • Modal host measurement obtained a theme TypedArray without recycling it.

This change uses InputStream.use, rejects missing/undecodable streams through the existing error path, restores the original thread policy in finally, and recycles the typed array in finally.

Regression coverage

The new Robolectric regression forces dev-image stream opening to fail and verifies the original network-detecting thread policy is restored. The exact baseline leaves the permissive policy installed.

Verification

  • focused regression: 1/1 passed
  • full Android unit suite: 698 passed, 2 skipped, 0 failed
  • Android debug Kotlin/Java compilation passed
  • git diff --check passed

Breaking changes

None. Failed image decoding continues through the existing error callback; resources and thread policy are now cleaned up reliably.

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.

1 participant