Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
None
-
5.15.2
-
None
-
-
2023wk26FOQtforAndroid
Description
With Qt 5.15, support was added for content:// URIs within the Qt file API.
You can thus obtain a content:// URI via certain native Android APIs and use it anywhere a file:// URI could be used, e.g. a QML Image.source.
However it only works with URIs for which a "persistable permission" is granted. The QtNative.java implementations check for this permission. (https://code.qt.io/cgit/qt/qtbase.git/tree/src/android/jar/src/org/qtproject/qt5/android/QtNative.java?h=5.15.2#n241).
This is unnecessary and leads to problems though. If you obtain a content URI via the MediaStore API (https://developer.android.com/training/data-storage/shared/media#java), you cannot get a persistable permission. These only work via intents when obtaining URLs from other apps (e.g. the native gallery picker).
-> I propose a change in QtNative.java that any type of content URI can be used instead, or a public method to add a content URI to the cache in QtNative manually.
Probably affects all versions from 5.15+.