Menu

#86 "FileNotFoundException: No content provider" when opening files on Android 11

v1.0_(example)
closed
nobody
None
1
2021-09-26
2021-09-24
Georg Lukas
No

I'm using Ghost Commander 1.60.4 on a Samsung Android 11 phone.

When I try to open a file on the internal storage from GC in my own app, APRSdroid, the target app crashes with the following exception:

java.io.FileNotFoundException: No content provider: content://com.ghostsq.commander.FileProvider/FS/L3N0b3JhZ2UvZW11bGF0ZWQvMC9Eb2N1bWVudHMvQVBSU2Ryb2lk/profile-20210924-1108.aprs
    at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1979)
    at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1808)
    at android.content.ContentResolver.openInputStream(ContentResolver.java:1485)
    at org.aprsdroid.app.ProfileImportActivity.import_config(ProfileImportActivity.scala:32)
    at org.aprsdroid.app.ProfileImportActivity.onCreate(ProfileImportActivity.scala:26)
    at android.app.Activity.performCreate(Activity.java:8207)
    at android.app.Activity.performCreate(Activity.java:8191)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3800)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4003)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2317)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8595)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

The same code path works on an Android 9 Samsung phone and on Android 11 LineageOS, so I'm not even sure which part is to blame.

My code is using the standard recommended logic from Android: https://github.com/ge0rg/aprsdroid/blob/master/src/ProfileImportActivity.scala#L32 and is crashing right in there.

Ghost Commander is actually exporting the FileProvider on the phone:

  [com.ghostsq.commander.FileProvider]:
    Provider{6ccc6fb com.ghostsq.commander/.FileProvider}
      applicationInfo=ApplicationInfo{c45c69a com.ghostsq.commander}

Googling the error message yields apps that are apparently mixing up https URIs with local content so is not applicable to this issue.

Any ideas how to solve / work around this problem?

Discussion

  • zc2

    zc2 - 2021-09-24

    Hi Georg,

    Can you try to record a logcat (verbose) to check if there any messages from GC.FileProvider ?

    This issue could be related to unknown file type. Could you try to open a file of some well known extension rather than ".aprs" ? For unknown extension GC.FileProvider returns the mime type "/" which may not be liked by the ContentResolver.

     
  • Georg Lukas

    Georg Lukas - 2021-09-25

    Here's what I see from the GC PID around opening the file, nothing suspicious from FileProvider (not even a mention of its TAG in the log):

    09-25 08:26:50.039 18307 18307 D GhostCommanderActivity: Open uri content://com.ghostsq.commander.FileProvider/FS/L3N0b3JhZ2UvZW11bGF0ZWQvMC9Eb2N1bWVudHMvQVBSU2Ryb2lk/profile-20210924-1108.aprs intent: Intent { act=android.intent.action.VIEW dat=content://com.ghostsq.commander.FileProvider/FS/L3N0b3JhZ2UvZW11bGF0ZWQvMC9Eb2N1bWVudHMvQVBSU2Ryb2lk/profile-20210924-1108.aprs typ=*/* flg=0x10080000 }
    09-25 08:26:50.103 18307 18307 W KeyStore: get(CACERT_Crypt) return_code(7)
    09-25 08:26:50.110 18307 18307 D GhostCommanderActivity: onActivityResult( 3, null )
    09-25 08:26:50.160 18307 18307 I ViewRootImpl@8c54cf3[FileCommander]: stopped(false) old=false
    09-25 08:26:50.173 18307 18307 W KeyStore: get(CACERT_Crypt) return_code(7)
    

    Maybe the invalid mime type is really the culprit, I haven't seen any other apps crashing yet from this. My app only registrs for .aprs and .p12, and the p12 files crash with the same error message.

    I'll add a handler for .txt or something like that in the next days and see if it still crashes.

     
    • zc2

      zc2 - 2021-09-26

      I made the FileProvider to return "application/octet-stream" instead of "/" for unknown types. Could you please give a try to a new beta ? If the behaviour won't change, can you send me your app's apk file?

       
      • Georg Lukas

        Georg Lukas - 2021-09-26

        Thanks very much! I can confirm that the new APK allows importing both .aprs and .p12 files.

         
  • zc2

    zc2 - 2021-09-26
    • status: open --> closed
     
  • zc2

    zc2 - 2021-09-26

    Thank you for testing!

     

Log in to post a comment.

MongoDB Logo MongoDB