Application crashes when trying add local directory

Issue description:

Application crashes when I try to add my local directory. It doesn’t mean if it is from SD Card or phone mass storage as it crashes just after selecting “By folders / SDCard”. It happend while first setup but also through Settings → Add media provider → Local device → By folders / SDCard → Add folder.
I manually gave permissions to multimedia as application didn’t ask by itself.
Phone - Samsung S10e, Android 12, stock ROM with One UI 4.1.

Logs:

Upload description: yoGhurrt1

Additional information:

 

 

Reproduction steps:

 
Settings → Add media provider → Local device → By folders / SDCard → Add folder.
 

Media provider:

Local device

Screenshots:

     

The logs does not contains the crash and it’s normal that the permission is not asked it’s not needed.

See for example How to create a bug report on Android devices | Avast to provide a bug report that will contain the crash.

Upload to https://upload.symfonium.app then tell me.

Done. Not sure if description was added, as I did it when upload was halfway through, so search for filename “bugreport-beyond0lteeea-SP1A.210812.016-2024-05-01-10-20-55.zip”.

Well that’s a strange one :frowning:

05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: FATAL EXCEPTION: ProviderExecutor: com.android.externalstorage.documents
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: Process: com.google.android.documentsui, PID: 20252
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.os.AsyncTask$4.done(AsyncTask.java:415)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:271)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at com.android.documentsui.ProviderExecutor.run(ProviderExecutor.java:104)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: Caused by: java.lang.SecurityException: ContentService: Neither user 10014 nor current process has android.permission.CACHE_CONTENT.
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.os.Parcel.createExceptionOrNull(Parcel.java:2438)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.os.Parcel.createException(Parcel.java:2422)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:2405)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:2347)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.content.IContentService$Stub$Proxy.getCache(IContentService.java:2407)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.content.ContentResolver.getCache(ContentResolver.java:3744)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at com.android.documentsui.roots.ProvidersCache.loadRootsForAuthority(ProvidersCache.java:370)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at com.android.documentsui.roots.ProvidersCache.getRootOneshot(ProvidersCache.java:429)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at com.android.documentsui.roots.ProvidersCache.getRootOneshot(ProvidersCache.java:419)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at com.android.documentsui.roots.LoadRootTask.run(LoadRootTask.java:61)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at com.android.documentsui.roots.LoadRootTask.run(LoadRootTask.java:33)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at com.android.documentsui.base.CheckedTask.doInBackground(CheckedTask.java:65)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.os.AsyncTask$3.call(AsyncTask.java:394)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	... 1 more
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace:
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.app.ContextImpl.enforce(ContextImpl.java:2274)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2302)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at com.android.server.content.ContentService.getCache(ContentService.java:1429)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.content.IContentService$Stub.onTransact(IContentService.java:1139)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 	at android.os.Binder.execTransactInternal(Binder.java:1215)
05-01 10:16:11.568 10014 20252 20317 E AndroidRuntime: 

ActivityTaskManager:   Force finishing activity com.google.android.documentsui/com.android.documentsui.picker.PickActivity

ActivityTaskManager:   Force finishing activity app.symfonik.music.player/app.symfonik.ui.MainActivity


There’s something wrong with your ROM that permission is

    <!-- @hide Allows an application to cache content.
         <p>Not for use by third-party applications.
    -->
    <permission android:name="android.permission.CACHE_CONTENT"
        android:protectionLevel="signature|documenter" />

So no idea why the system picker does not have it if it should. But there’s nothing I can do on the app side, you can use the android mode, but I suppose any app that request a SAF folder will be killed the same and you should try to figure out why.