https://bugs.kde.org/show_bug.cgi?id=447636

Andrew Gunnerson <accounts+...@chiller3.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |accounts+...@chiller3.com

--- Comment #6 from Andrew Gunnerson <accounts+...@chiller3.com> ---
I was able to get it working with MANAGE_EXTERNAL_STORAGE, but it's not quite
as simple as adding the permission to the manifest. Once the "All files"
permission is granted by the user via the Android Settings [1], KDE Connect is
immediately allowed access to the root of the storage volume. However, it must
do so via standard filesystem APIs, not via SAF's ACTION_OPEN_DOCUMENT_TREE.
Even with the permission, accessing the storage root via SAF is not allowed.

I made a very hacky hardcoded proof of concept here:
https://invent.kde.org/chenxiaolong/kdeconnect-android/-/commit/53370709d607055a0593a1dd743733858977cf05
It's working fine on a Google Pixel 6 Pro running Android 13 Beta 2.1. I can
read and write files from the primary storage root.

For a proper implementation, I believe these are the necessary changes:

* A UI option for selecting the primary storage volume. If the "All files"
permission hasn't been granted, the
ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION intent can take the user straight
to the permissions settings. The file:// URI for the primary storage volume can
be retrieved from StorageManager.getPrimaryStorageVolume().getDirectory().
* Adjust some Build.VERSION.SDK_INT checks that enable file:// support to be
uri.getScheme().equals(ContentResolver.SCHEME_FILE) instead.
* Maybe refactor the FileSystemView abstraction to allow a mixture of SAF and
non-SAF roots? Eg. the user might select the primary storage (non-SAF with
MANAGE_EXTERNAL_STORAGE) as well as an SD card (SAF).

I unfortunately don't have time to implement this myself, but hope this
information might be useful to others.

[1] Either by sending the user there via the
ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION intent or manually going to
Settings -> Apps -> Special app access -> All files access -> KDE Connect ->
Allow

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to