Potential UI thread blocking issue
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 920
- PR merge metrics
- No merged PRs in 30d
Description
-
In TermuxApiReceiver.java, the doWork() method calls SAFAPI.onReceive(this, context, intent).
Since the implementation of onReceive() performs synchronous file I/O operations, this may also block the UI thread and potentially cause an ANR. -
In WallpaperAPI.java, onStartCommand() calls getWallpaperFromFile() and getWallpaperFromUrl(), both of which eventually invoke onWallpaperResult(). This method performs bitmap processing and writes the wallpaper to disk. Since these operations are executed on the main thread, the synchronous image processing and file I/O may block the UI thread and cause ANR. According to best practices, the execution of getWallpaperFromFile() and getWallpaperFromUrl() should be moved to a background thread.
-
In MicRecorderAPI.java, onDestroy() calls cleanupMediaRecorder(). Since cleanupMediaRecorder() involves the synchronous call mediaRecorder.stop(), executing it on the UI thread may block the main thread. Following best practices, this method should be moved to a background thread.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing TermuxApiReceiver.java's doWork(), WallpaperAPI.java's onStartCommand(), getWallpaperFromFile(), getWallpaperFromUrl(), and onWallpaperResult(), plus MicRecorderAPI.java's onDestroy() and cleanupMediaRecorder(). Verify which synchronous I/O, bitmap processing, and mediaRecorder.stop() calls run on the main thread; done means the listed operations no longer block the UI thread without changing their behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100