mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #1504] Potential UI thread blocking: bitmap decoding and file I/O in ShareActivity #1061
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#1061
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nbd-boss on GitHub (Dec 1, 2025).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1504
Description
In
ShareActivity, bothhandleSendImage()andhandleSendFile()perform potentially heavy operations on the main (UI) thread.Relevant code
1.
handleSendImage()The helper function
readBitmapFromUri()performs:contentResolver.openInputStream()→ synchronous file I/OBitmapFactory.decodeStream()→ CPU-heavy bitmap decodingBoth operations run on the main thread.
2.
handleSendFile()fileStat()performs synchronous file access on the main thread.Why this is a problem
Opening an InputStream from a resolver can be slow, especially for:
BitmapFactory.decodeStream()is a known CPU-heavy operation.These operations may block the UI thread and cause visible freezes or jank.
Google’s official guidelines state that file I/O and bitmap decoding should not be performed on the main thread.
Expected behavior
UI remains responsive while loading and decoding shared images or files.