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

Broken opening of files with content:// Uri filenames

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • 6.7.0
    • 6.6
    • Core: I/O
    • None
    • Android 14
    • Android
    • 2024wk40s3FOQtforAndroid

    Description

      Opening of files given by content:// Uri:

      QFile file("content://eu.basicairdata.graziano.gpslogger.fileprovider/cache/Tracks/20240117-192053.gpx");
      file.open(QFile::ReadOnly);
      

      is broken in Qt 6.6 on Android. This is a regression to Qt 6.4.0 where opening of such file names worked fine. Trying to open such file ends with the following error log stream:

      W gpxsee : java.lang.IllegalArgumentException: Invalid URI: content://eu.basicairdata.graziano.gpslogger.fileprovider/cache/Tracks
      W gpxsee : at android.provider.DocumentsContract.getTreeDocumentId(DocumentsContract.java:1294)
      W gpxsee : at org.qtproject.qt.android.QtNative.startQtApplication(Native Method)
      W gpxsee : at org.qtproject.qt.android.QtNative$7.run(QtNative.java:465)
      W gpxsee : at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25)
      W gpxsee : at java.lang.Thread.run(Thread.java:1012)
      01-23 15:05:56.165 3856 3883 W gpxsee :
      W gpxsee : java.lang.IllegalArgumentException: Invalid URI: content://eu.basicairdata.graziano.gpslogger.fileprovider/cache/Tracks
      W gpxsee : at android.provider.DocumentsContract.getTreeDocumentId(DocumentsContract.java:1294)
      W gpxsee : at android.provider.DocumentsContract.buildDocumentUriUsingTree(DocumentsContract.java:1011)
      W gpxsee : at org.qtproject.qt.android.QtNative.startQtApplication(Native Method)
      W gpxsee : at org.qtproject.qt.android.QtNative$7.run(QtNative.java:465)
      W gpxsee : at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25)
      W gpxsee : at java.lang.Thread.run(Thread.java:1012)
      01-23 15:05:56.165 3856 3883 W gpxsee :
      W gpxsee : java.lang.NullPointerException: uri
      W gpxsee : at java.util.Objects.requireNonNull(Objects.java:232)
      W gpxsee : at android.content.ContentResolver.query(ContentResolver.java:1203)
      W gpxsee : at android.content.ContentResolver.query(ContentResolver.java:1161)
      W gpxsee : at android.content.ContentResolver.query(ContentResolver.java:1117)
      W gpxsee : at org.qtproject.qt.android.QtNative.startQtApplication(Native Method)
      W gpxsee : at org.qtproject.qt.android.QtNative$7.run(QtNative.java:465)
      W gpxsee : at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25)
      W gpxsee : at java.lang.Thread.run(Thread.java:1012)
      01-23 15:05:56.165 3856 3883 W gpxsee :
      W gpxsee : java.lang.IllegalArgumentException: Invalid URI: content://eu.basicairdata.graziano.gpslogger.fileprovider/cache/Tracks
      W gpxsee : at android.provider.DocumentsContract.getTreeDocumentId(DocumentsContract.java:1294)
      W gpxsee : at org.qtproject.qt.android.QtNative.startQtApplication(Native Method)
      W gpxsee : at org.qtproject.qt.android.QtNative$7.run(QtNative.java:465)
      W gpxsee : at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25)
      W gpxsee : at java.lang.Thread.run(Thread.java:1012)
      01-23 15:05:56.169 3856 3883 W gpxsee :
      W gpxsee : java.lang.IllegalArgumentException: Invalid URI: content://eu.basicairdata.graziano.gpslogger.fileprovider/cache/Tracks
      W gpxsee : at android.provider.DocumentsContract.getTreeDocumentId(DocumentsContract.java:1294)
      W gpxsee : at android.provider.DocumentsContract.buildDocumentUriUsingTree(DocumentsContract.java:1011)
      W gpxsee : at org.qtproject.qt.android.QtNative.startQtApplication(Native Method)
      W gpxsee : at org.qtproject.qt.android.QtNative$7.run(QtNative.java:465)
      W gpxsee : at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25)
      W gpxsee : at java.lang.Thread.run(Thread.java:1012)
      01-23 15:05:56.169 3856 3883 W gpxsee :
      W gpxsee : java.lang.NullPointerException: uri
      W gpxsee : at java.util.Objects.requireNonNull(Objects.java:232)
      W gpxsee : at android.content.ContentResolver.query(ContentResolver.java:1203)
      W gpxsee : at android.content.ContentResolver.query(ContentResolver.java:1161)
      W gpxsee : at android.content.ContentResolver.query(ContentResolver.java:1117)
      W gpxsee : at org.qtproject.qt.android.QtNative.startQtApplication(Native Method)
      W gpxsee : at org.qtproject.qt.android.QtNative$7.run(QtNative.java:465)
      W gpxsee : at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25)
      W gpxsee : at java.lang.Thread.run(Thread.java:1012)
      01-23 15:05:56.169 3856 3883 W gpxsee :
      W gpxsee : java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider uri content://eu.basicairdata.graziano.gpslogger.fileprovider/cache/Tracks%2F20240117-192053.gpx from pid=3856, uid=10445 requires the provider be exported, or grantUriPermission()
      W gpxsee : at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
      W gpxsee : at android.os.Parcel.createException(Parcel.java:3053)
      W gpxsee : at android.os.Parcel.readException(Parcel.java:3036)
      W gpxsee : at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
      W gpxsee : at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:153)
      W gpxsee : at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:814)
      W gpxsee : at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:2043)
      W gpxsee : at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1858)
      W gpxsee : at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:1689)
      W gpxsee : at android.content.ContentResolver
      

      Note, that this is not a permission issue as it may look from the log as the file is perfectly accessible from java+, but opening it using Qt fails.

      This is a major issue as on newer Android versions this is the only way how to work with files received from other applications on Android.

      + You can test that by modifying the intentPath() function in GPXSee which is the application used to trigger the bug

      Attachments

        Issue Links

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

          Activity

            People

              qtandroidteam Qt Android Team
              tumic Martin Tůma
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes