Recent files doesn't display recent files #4067
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RCA -
There was a check in
LoadFilesListTask.listRecentFiles()
that only list the file if it is not directory, which is not a case if file is not created instorage/emulated0/
directory. The recently changed file would always come wrapped in some folder if created in a directory other thanstorage/emulated/0/
. Which was causing this issue.Resolution -
In the solution provided it is assumed that we have to only show the files that were modified, hence, only modified/created files are listed and not the folders (as the title suggests ‘Recent Files’). Here, if the file is wrapped in a directory, the directory is recursively explored to check the files it contains. As we loop around recursively we go on adding the files that we find in a final list that is to be returned.
In this code, every file that comes from cursor will always be wrapped in some folder and it will be explored recursively and listed.
Description
Issue tracker
Fixes #3991
Manual tests
Done
Device: Android Studio Emulator
OS: Android 11 ("R") API 30
Build tasks success
Successfully running following tasks on local:
./gradlew assembledebug
./gradlew spotlessCheck