Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-94509

Content URIs don't work without persistable permission

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • None
    • 5.15.2
    • Extras: Android
    • None
    • Android
    • 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+.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            assam Assam Boudjelthia
            Chrisu Christian Bartsch
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes