| Summary: | Android 11: scoped storage does not allow to share the root of the filesystem | ||
|---|---|---|---|
| Product: | [Applications] kdeconnect | Reporter: | Tobias Bora <tobias.bora> |
| Component: | android-application | Assignee: | Albert Vaca Cintora <albertvaka> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | A.Tetzner, accounts+kde, adrian, andreamarano2004, cirlo_ca, clay, gwarser, jan.rathmann, kde, l12c-account_for_kde, lantw44, maxxxreuben, simon, teohhanhui, varishtsg, zawertun |
| Priority: | NOR | Keywords: | junior-jobs |
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Android | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/network/kdeconnect-android/commit/1ba9e59872e811615a152882469e9b9f07cc7001 | Version Fixed/Implemented In: | 1.24.0 |
| Sentry Crash Report: | |||
|
Description
Tobias Bora
2021-12-29 11:04:37 UTC
I face the same issue. Was previously able to select root folder of my phone as mount point, but it doesn't allow anymore in Android 11.0.5.1 on a OnePlus 7T running OxygenOS. Kdeconnect app version: 1.19.1 *** Bug 439342 has been marked as a duplicate of this bug. *** For reference of anyone working on this, here's the Android documentation link for MANAGE_EXTERNAL_STORAGE -- I suspect adding this permission will solve the issue described, though we will have to grovel to Google to let us continue publishing on the Play Store. https://developer.android.com/training/data-storage/manage-all-files Set the junior-jobs keyword since this is hopefully we simple as adding the permission and changing the intent action, both described in the documentation linked in my previous comment. This bug affects Android 12 (Lineage OS 19.1 on Poco F1) as well. Dunno how I didn't encounter it on Android 11 (Lineage OS 18.1 on Poco F1), maybe because the permissions were carried over from my previous install. I recently did a fresh install of Lineage OS 19.1 on Poco F1 and encountered this bug there. 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 *** Bug 447774 has been marked as a duplicate of this bug. *** Git commit 1ba9e59872e811615a152882469e9b9f07cc7001 by Albert Vaca Cintora, on behalf of Albert Vaca Cintora. Committed on 19/03/2023 at 20:26. Pushed by albertvaka into branch 'master'. SftpPlugin: use MANAGE_EXTERNAL_STORAGE instead of SAF in Android 11+ https://developer.android.com/training/data-storage/manage-all-files Related: bug 464431 M +1 -0 AndroidManifest.xml M +1 -0 res/values/strings.xml M +63 -26 src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpPlugin.java M +14 -5 src/org/kde/kdeconnect/Plugins/SftpPlugin/SimpleSftpServer.java M +20 -2 src/org/kde/kdeconnect/UserInterface/StartActivityAlertDialogFragment.java https://invent.kde.org/network/kdeconnect-android/commit/1ba9e59872e811615a152882469e9b9f07cc7001 Is this happening again? On my Pixel 7a, it seems that the exact symptoms have appeared again after an update (Android 14), just like how I remembered it. I'm getting the dreaded "Some Plugins need permissions to work (tap for more info): Filesystem expose". And once again, it asks you to configure a storage location and doesn't let you pick home. (In reply to SC from comment #9) > Is this happening again? On my Pixel 7a, it seems that the exact symptoms > have appeared again after an update (Android 14), just like how I remembered > it. > > I'm getting the dreaded "Some Plugins need permissions to work (tap for more > info): Filesystem expose". And once again, it asks you to configure a > storage location and doesn't let you pick home. You're not the only one, I am encountering the same problem on Android 14 too. In an attempt to resolve the issue, I installed the 'NoStorageRestrict' Xposed module on my rooted device. However, the application crashes when I try to select a storage location. (In reply to SC from comment #9) > Is this happening again? On my Pixel 7a, it seems that the exact symptoms > have appeared again after an update (Android 14), just like how I remembered > it. > > I'm getting the dreaded "Some Plugins need permissions to work (tap for more > info): Filesystem expose". And once again, it asks you to configure a > storage location and doesn't let you pick home. I've just discovered that this issue is specific to version 1.32.2 (the Play Store version). The changelog states: > (!) Temporarily removed external storage access because Google was rejecting the app updates otherwise. Installing the app from F-Droid (version 1.32.1) resolves the issue. (In reply to Andrea Marano from comment #11) > Google was rejecting the app updates otherwise. Oh of course. Fuck Google. Reverting back to 1.32.1 restored the functionality. |