Checklist
Steps to reproduce the bug
- Go to Menu
- Go to the Subscriptions tab
- Import from YouTube
- Select CSV file
Actual behavior
Exception showed at importing the CSV file
Expected behavior
Import successful
Logs
Exception
- User Action: ui error
- Request: ACRA report
- Content Country: DE
- Content Language: de-DE
- App Language: de_DE
- Service: none
- Version: 0.21.13
- OS: Linux Android 12 - 31
Crash log
java.lang.RuntimeException: Unable to start service org.schabi.newpipe.local.subscription.services.SubscriptionsImportService@e2486eb with Intent { cmp=org.schabi.newpipe/.local.subscription.services.SubscriptionsImportService (has extras) }: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{66aa690 7020:org.schabi.newpipe/u0a306} (pid=7020, uid=10306) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4657)
at android.app.ActivityThread.access$2000(ActivityThread.java:247)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2091)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7838)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{66aa690 7020:org.schabi.newpipe/u0a306} (pid=7020, uid=10306) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
at android.os.Parcel.createException(Parcel.java:2409)
at android.os.Parcel.readException(Parcel.java:2392)
at android.os.Parcel.readException(Parcel.java:2334)
at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:5850)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:6972)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:3336)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:2526)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1844)
at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:1675)
at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:1622)
at us.shandian.giga.io.FileStreamSAF.<init>(FileStreamSAF.java:32)
at org.schabi.newpipe.streams.io.StoredFileHelper.getStream(StoredFileHelper.java:195)
at org.schabi.newpipe.local.subscription.services.SubscriptionsImportService.onStartCommand(SubscriptionsImportService.java:118)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4639)
... 9 more
Device info
- Android version/Custom ROM version: Android 12
- Device model: Google Pixel 4 5G
Updates / potential hints
Placing the CSV file at the Music location instead of Download, the import works without problems. For me it looks like the storage API changes are not aligned with the app (see: Access documents and other files from shared storage)
On Android 11 (API level 30) and higher, you cannot use the ACTION_OPEN_DOCUMENT intent action to request that the user select individual files from the following directories
Since API level 29 is used as app target, the following could fix the issue:
Scoped storage enforcement
Apps that run on Android 11 but target Android 10 (API level 29) can still request the requestLegacyExternalStorage attribute. This flag allows apps to temporarily opt out of the changes associated with scoped storage, such as granting access to different directories and different types of media files. After you update your app to target Android 11, the system ignores the requestLegacyExternalStorage flag.
Checklist
Steps to reproduce the bug
Actual behavior
Exception showed at importing the CSV file
Expected behavior
Import successful
Logs
Exception
Crash log
Device info
Updates / potential hints
Placing the CSV file at the Music location instead of Download, the import works without problems. For me it looks like the storage API changes are not aligned with the app (see: Access documents and other files from shared storage)
Since API level 29 is used as app target, the following could fix the issue: