There are potential time-consuming operations on the UI thread.
- Dominant language
- Java
- Stars
- 6.1k
- Forks
- 537
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 4
Description
### ⚠️ This issue respects the following points: ⚠️
- [x] This is a **bug**. Not a [question or feature request](https://github.com/gsantner/markor/issues/new/choose).
- [x] The topic is **not** already reported at [Issues](https://github.com/gsantner/markor/issues?q=#js-issues-search). _(I've searched it and checked most recent issues)_.
- [x] Markor **is** up to date. See [Releases](https://github.com/gsantner/markor/tags) for the latest version. Updates are available from [F-Droid](https://f-droid.org/en/packages/net.gsantner.markor/) and GitHub.
- [x] The bug is still present in the latest development version (git master). (Please [download](https://nightly.link/gsantner/markor/workflows/build-android-project/master) and try the test version of Markor, named **Marder**. Don't worry; Markor and Marder appear as completely separate applications. You can install both side-by-side, and Markor settings are not touched. In case the issue is resolved there, you don't need to create a bug report. The change will be part of the next Markor update.)
### Description
Hello,
We used a static analysis tool to check whether markor performs any potentially time-consuming operations on the UI thread. Our analysis identified the following potential issues:
In ActionButtonSettingsActivity.java, within the onCreate() method, the API call saveActionPreference() (via extractActionData → getActionOrder → saveActionOrder) involves file I/O or SharedPreferences access, which can trigger disk reads or writes synchronously on the main thread. According to Android best practices, such operations should be moved off the UI thread and executed in a background thread or coroutine. A test case was generated (`ActionButtonBase.saveActionPreference.kt`) but could not be fully compiled and verified in the sandbox environment — manual review is recommended.
In ActionButtonSettingsActivity.java, within the onCreate() method, the API call loadActionBarVisible() (via extractActionData → onActionDataExtracted) involves file I/O or SharedPreferences access, which can trigger disk reads or writes synchronously on the main thread. According to Android best practices, such operations should be moved off the UI thread and executed in a background thread or coroutine. A test case was generated (`ActionButtonBase.loadActionBarVisible.kt`) but could not be fully compiled and verified in the sandbox environment — manual review is recommended.
We hope this report helps improve markor's responsiveness and user experience.
### Information
Android version: SDK 37
Device (phone model): Pixel 9a
### Source
git master branch
### Format / File type
Not specific
### Additional info / Log
```shell
-
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in ActionButtonSettingsActivity.java and trace onCreate() through extractActionData to getActionOrder/saveActionOrder and onActionDataExtracted/loadActionBarVisible. Review the generated ActionButtonBase.saveActionPreference.kt and ActionButtonBase.loadActionBarVisible.kt cases, then determine whether the flagged operations actually run on the UI thread. Done means the concern is addressed and the relevant tests compile and verify the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100