Skip to content

[ai] search: Move indexed MediaStore query off main thread. - #4706

Open
muhamadsyafii wants to merge 1 commit into
TeamAmaze:release/4.0from
muhamadsyafii:syafii/bugfix/4646-indexed-search-main-thread-query
Open

[ai] search: Move indexed MediaStore query off main thread.#4706
muhamadsyafii wants to merge 1 commit into
TeamAmaze:release/4.0from
muhamadsyafii:syafii/bugfix/4646-indexed-search-main-thread-query

Conversation

@muhamadsyafii

@muhamadsyafii muhamadsyafii commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Indexed search previously created its MediaStore cursor before the search coroutine was launched, so ContentResolver.query(...) could run on the UI thread when triggered from SearchView.

Move cursor creation into the indexed search background work and keep result publication through the existing LiveData path.

Issue tracker

Fixes #4646

Automatic tests

  • Added unit tests for specific individual functions
  • Added headless tests for new app functionality
  • Added emulator tests for new UI elements

Manual tests

  • Done

  • Device: Android Emulator

  • OS: Android emulator used for local debug testing

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew assembleFdroidDebug
  • ./gradlew spotlessCheck
  • ./gradlew :app:testFdroidDebugUnitTest --tests com.amaze.filemanager.asynchronous.asynctasks.searchfilesystem.IndexedSearchTest

Generative code

  • This PR used generative code tools (GenAI, LLMs, etc.)

  • Model: GPT-5 Codex

  • Version: GPT-5

  • Provider: OpenAI

Indexed search previously created its MediaStore cursor before the
search coroutine was launched, so ContentResolver.query could run on
the UI thread when triggered from SearchView.

Move cursor creation into the indexed search background work and keep
result publication through the existing LiveData path.

Fixes TeamAmaze#4646.
@muhamadsyafii
muhamadsyafii force-pushed the syafii/bugfix/4646-indexed-search-main-thread-query branch from 4d1f853 to d71b74f Compare August 11, 2026 04:23
@VishnuSanal VishnuSanal added the PR-Awaiting-Initial-Review DEPRECATED use PR-Code-Review-Passed or PR-Manual-Testing-Passed label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Awaiting-Initial-Review DEPRECATED use PR-Code-Review-Passed or PR-Manual-Testing-Passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential main-thread ContentResolver query in Amaze file search flow

2 participants