Android: Make SAF slightly faster by getting rid of DocumentFile#2985
Merged
2 commits merged intoMay 31, 2023
Merged
Conversation
Ghabry
commented
May 4, 2023
| String documentId = DocumentsContract.getTreeDocumentId(rootUri); | ||
| if (DocumentsContract.isDocumentUri(context, rootUri)) { | ||
| documentId = DocumentsContract.getDocumentId(rootUri); | ||
| } |
Member
Author
There was a problem hiding this comment.
no idea why this is needed. I copied this from the DocumentFile constructor. When its missing it doesn't work 🤷
Member
Author
|
Looking for some testers here: Please install the APK and test if games still work (in ZIP and extracted). Also curious about the "feeling" if it is for you the same performance or slower/faster (also try measuring the game load time). |
Member
Author
|
No idea why but this breaks custom SF when the game is not inside a zip |
…he native code wrapper Also do not query anything when the entire goal is to open a file descriptor.
…hout querying SAF
Member
Author
|
I think this works now. The problem here was that SAF transforms invalid URIs to a root URI (extremely stupid). Then opening this root URI gives a valid file descriptor to a directory. I detect this case now... |
ghost
approved these changes
May 25, 2023
sevenc-nanashi
pushed a commit
to sevenc-nanashi/easyrpg-player
that referenced
this pull request
May 31, 2026
Android: Make SAF slightly faster by getting rid of DocumentFile
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…in the native code wrapper
Also do not query anything when the entire goal is to open a file descriptor.
This should make opening of files for reading slightly faster as the DocumentFile roundtrip is gone.
However in my tests it doesn't feel faster. There are still awful lagspikes when a new file is being opened m(
This also could break stuff so have fun sharing and testing ;).