nextcloud / nextcloud/android

Support for EXTRA_INITIAL_URI in ACTION_OPEN_DOCUMENT_TREE and similar

Open
#11,101 0 comments 0 reactions 0 assignees View on GitHub
enhancement feature: document provider hotspot: device storage
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### Is your feature request related to a problem? Please describe.
When calling ACTION_OPEN_DOCUMENT_TREE with an URI returned from a prior call, Android allows to request that the SAF file picker starts on the given location by providing EXTRA_INITIAL_URI. Unfortunately this does not work with a folder selected from Nextcloud. The following stacktrace is printed to logcat:

```
Failed to build document stack for uri: content://org.nextcloud.documents/document/e3d747548b8ed31dbbf9de73ad765029%2F1
java.lang.UnsupportedOperationException: findDocumentPath not supported.
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
at android.content.ContentProviderProxy.call(ContentProviderNative.java:658)
at android.content.ContentProviderClient.call(ContentProviderClient.java:558)
at android.content.ContentResolver.call(ContentResolver.java:2035)
at android.provider.DocumentsContract.findDocumentPath(DocumentsContract.java:1590)
at com.android.documentsui.DocumentsAccess$RuntimeDocumentAccess.findDocumentPath(DocumentsAccess.java:130)
at com.android.documentsui.LoadDocStackTask.run(LoadDocStackTask.java:75)
at com.android.documentsui.LoadDocStackTask.run(LoadDocStackTask.java:43)
at com.android.documentsui.base.CheckedTask.doInBackground(CheckedTask.java:65)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.android.documentsui.ProviderExecutor.run(ProviderExecutor.java:104)
```

In my use case, I am using ACTION_OPEN_DOCUMENT_TREE to allow the user to select a folder where backups and exports are stored. For this, it would provide more than cosmetic value, if this worked, because it would allow the user to clearly understand the currently selected folder which otherwise is difficult to represent to him, because neither the full Uri, nor the display name clearly give the full picture.

### Describe the solution you'd like
Given the above stacktrace, I assume that findDocumentPath needs to be implemented in class DocumentsStorageProvider.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.