This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
Conversation
This file contains 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
A proof-of-concept java.nio.file.spi.FileSystemProvider implementation for working with `content://` scheme URIs. The very basic implementation supports use of `Files.walk()` and the `Path` objects returned can be passed directly to `okio` methods. The implementation includes a token set of tests due to the way content:// uri access is usually granted (via the system file picker). Currently working on how to write more useful cases.
Adds scaffolding for a demo of the filesystem library.
Delegate the `isTree` method to `ContentPath`.
Adds a pair of test cases for a single document Path. Creating a Uri that's used with DocumentsContract to connect to a test DocumentProvider and return content.
Add a check for a Root.MIME_TYPE_ITEM for deciding if a document is a directory or not.
- Builds a DocumentsProvider for testing the filesystem code with ContentResolver. - Built a small DSL to allow creating a document tree for test cases that doesn't rely on creating files.
Builds up the TestDocumentProvider to support operations needed for walking a tree.
This changes the implementation to extract all the Android specific calls from the main FileSystem classes so that we'll be able to write host side unit tests that run without Android/Robolectric. NOTE: Technically there are a couple of methods left, but they're more difficult to extract in a clean way at the moment, so I've left them. In ExternalStoragePath: - android.os.Environment#getExternalStorageDirectory() - android.os.Process#myPid()
First set of host side tests for ContentFileSystemProvider et al.
Switch copyright from AOSP to Google LLC (to match the rest of ModernStorage).
Register URIs when an instance of a ContentFileSystem is created, and allow retrieving them with `ContentFileSystem.getRootDirectories()`
Refactors some of the provider specific methods to the FileSystem level (which are backed by individual providers already), and changes the test init method from `installContentFileSystem` to `initialize` to more closely match app code.
Adds generic & ExternalStorageProvider specific implementations for "ContentPath#getParent()", along with host side tests. It would be nice to have instrumentation tests, but I haven't been able to grant access to any ExternalStorageProvider APIs in a test. I could implement it for TestDocumentProvider but that would also require a bit more work.
Test: Existing tests pass
Add API metadata Unify build.gradle for both libraries
* Import proof-of-concept ContentFileSystemProvider A proof-of-concept java.nio.file.spi.FileSystemProvider implementation for working with `content://` scheme URIs. The very basic implementation supports use of `Files.walk()` and the `Path` objects returned can be passed directly to `okio` methods. The implementation includes a token set of tests due to the way content:// uri access is usually granted (via the system file picker). Currently working on how to write more useful cases. * Sample scaffolding Adds scaffolding for a demo of the filesystem library. * Minor update for ExternalStoragePath Delegate the `isTree` method to `ContentPath`. * Add test case for single document Adds a pair of test cases for a single document Path. Creating a Uri that's used with DocumentsContract to connect to a test DocumentProvider and return content. * Add check for "root" Add a check for a Root.MIME_TYPE_ITEM for deciding if a document is a directory or not. * Improve test cases - Builds a DocumentsProvider for testing the filesystem code with ContentResolver. - Built a small DSL to allow creating a document tree for test cases that doesn't rely on creating files. * Add basic test for Files.walk Builds up the TestDocumentProvider to support operations needed for walking a tree. * Extract Android classes This changes the implementation to extract all the Android specific calls from the main FileSystem classes so that we'll be able to write host side unit tests that run without Android/Robolectric. NOTE: Technically there are a couple of methods left, but they're more difficult to extract in a clean way at the moment, so I've left them. In ExternalStoragePath: - android.os.Environment#getExternalStorageDirectory() - android.os.Process#myPid() * Host side tests First set of host side tests for ContentFileSystemProvider et al. * Update copyright Switch copyright from AOSP to Google LLC (to match the rest of ModernStorage). * Remove debug log statements * Register FileSystem "roots" Register URIs when an instance of a ContentFileSystem is created, and allow retrieving them with `ContentFileSystem.getRootDirectories()` * Minor update to test code * Refactoring Refactors some of the provider specific methods to the FileSystem level (which are backed by individual providers already), and changes the test init method from `installContentFileSystem` to `initialize` to more closely match app code. * Fix license header * Add "getParent" implementation Adds generic & ExternalStorageProvider specific implementations for "ContentPath#getParent()", along with host side tests. It would be nice to have instrumentation tests, but I haven't been able to grant access to any ExternalStorageProvider APIs in a test. I could implement it for TestDocumentProvider but that would also require a bit more work. * Apply Spotless Test: Existing tests pass * Address PR comments.
This adds a few files from the .idea directory to the repo, based on the .gitignore (and some settings) from AndroidX.
yrezgui
commented
Jul 12, 2021
nic0lette
reviewed
Jul 13, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass is mostly good. Thinking about the minSdkVersion
thing :)
sample/src/main/java/com/google/modernstorage/sample/filesystem/FileSystemFragment.kt
Outdated
Show resolved
Hide resolved
sample/src/main/java/com/google/modernstorage/sample/filesystem/FileSystemFragment.kt
Outdated
Show resolved
Hide resolved
sample/src/main/java/com/google/modernstorage/sample/filesystem/FileSystemFragment.kt
Show resolved
Hide resolved
sample/src/main/java/com/google/modernstorage/sample/filesystem/FileSystemViewModel.kt
Show resolved
Hide resolved
nic0lette
reviewed
Jul 13, 2021
sample/src/main/java/com/google/modernstorage/sample/filesystem/FileSystemViewModel.kt
Outdated
Show resolved
Hide resolved
Add minSDK check in demo list
…ent preview logic Use Files.readAllLines instead Files.newBufferedReader Add comments in DemoListAdapter.kt
Upgrade dependencies
nic0lette
approved these changes
Jul 15, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
filesystem
packagefilesystem
packageminSdk
to API 26 in thebuild.gradle
@nic0lette Actual changes since your PR got merged: https://github.com/google/modernstorage/pull/35/files/3b7106c574606bd97f32eb777a06f0ddc49e0fb9..a13cd3a030e8d4c7fc8d80c18a842f5da0fd4254