Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken OTGUtil.getDocumentFile() #4047

Merged
merged 1 commit into from
Jan 25, 2024
Merged

Fix broken OTGUtil.getDocumentFile() #4047

merged 1 commit into from
Jan 25, 2024

Conversation

TranceLove
Copy link
Collaborator

Description

Addresses #4038, that under specific root URI the file/folders should be able to be found correctly.

Previously the code is looking for file by splitting parts of a non-decoded URI against a decoded URI root, e.g.

root URI = content://com.android.externalstorage.documents/tree/primary:Android/data/com.poobslag.turbofat/files
looking file path = content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fdata%2Fcom.poobslag.turbofat/files

which would most likely fail. This PR fixes it by also decoding the path it is looking for.

Issue tracker

Addresses #4038, as there is still yet to find the way to manipulate the URI root - current implementation of Android/data access is by package, which would still work on Android 13.

Manual tests

  • Done

  • Device: Pixel 5 emulator

  • OS: Android 11

Delete a directory under a certain package in Android/data would work.

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

Addresses #4038, that under specific root URI the file/folders should be able to be found correctly.
@TranceLove
Copy link
Collaborator Author

TranceLove commented Jan 12, 2024

Pending tasks:

  • define scope of regression tests by looking at the places calling OTGUtil.getDocumentFile()
  • run and verify all regression tests

@TranceLove
Copy link
Collaborator Author

TranceLove commented Jan 14, 2024

Regression tests that should pass (wild guess, may be overkill)

  • OTG side
    • create folder
    • create file
    • rename folder
    • rename file
    • move folder
    • move file
    • copy folder
    • copy file
    • delete folder
    • delete file
  • Android/data/{any packageId}
    • create folder (partially working - folder not visible in Amaze but visible in DocumentsUI)
    • create file
    • rename folder
    • rename file
    • move folder (partially working - folder not visible in Amaze but visible in DocumentsUI)
    • move file (partially working - need to refresh to make original file disappear)
    • move folder from storage to Android/data/{any packageId}
    • move file from storage to Android/data/{any packageId} (partially working - need to refresh to make original file disappear)
    • move folder from Android/data/{any packageId} to storage
    • move file from Android/data/{any packageId} to storage (partially working - need to refresh to make original file disappear)
    • move folder from Android/data/{packageId 1} to Android/data/{packageId 2}
    • move file from Android/data/{packageId 1} to Android/data/{packageId 2}
    • copy folder
    • copy file
    • copy folder from storage to Android/data/{any packageId}
    • copy file from storage to Android/data/{any packageId}
    • copy folder from Android/data/{any packageId} to storage
    • copy file from Android/data/{any packageId} to storage
    • copy folder from Android/data/{packageId 1} to Android/data/{packageId 2}
    • copy file from Android/data/{packageId 1} to Android/data/{packageId 2}
    • delete folder
    • delete file
    • open in text editor
    • update in text editor

File operations between different package IDs are not supported as OTGUtils's design, only one root URI is available.

@TranceLove TranceLove changed the base branch from release/4.0 to release/3.10 January 14, 2024 11:11
@VishnuSanal VishnuSanal changed the title Fix b0rken OTGUtil.getDocumentFile() Fix broken OTGUtil.getDocumentFile() Jan 14, 2024
@VishalNehra VishalNehra merged commit 2b2d812 into release/3.10 Jan 25, 2024
4 checks passed
@VishalNehra VishalNehra added this to the v3.9 milestone Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants