Skip to content

[Bug] There are potential time-consuming operations on the UI thread. #1233

@ab13431

Description

@ab13431

  • Tried latest version

  • This issue is not duplicated with any other open or closed issues

Describe the bug

We used a static analysis tool to check whether ytdlnis performs any potentially time-consuming operations on the UI thread. Our analysis identified the following potential issues:

In App.kt, within the onCreate() method, the API call setDefaultValues() 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 (App.onCreate.kt) but could not be fully compiled and verified in the sandbox environment — manual review is recommended.

In App.kt, within the setDefaultValues() method, the operation 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 (App.setDefaultValues.kt) but could not be fully compiled and verified in the sandbox environment — manual review is recommended.

Expected behavior

No response

Screenshots / Recordings

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions