Android contentResolver崩溃。openInputStream(uri)获取安全权限被拒绝

Android contentResolver崩溃。openInputStream(uri)获取安全权限被拒绝,android,Android,应用程序崩溃并记录问题- Caused by java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.docs.storagebackend.StorageBackendContentProvider from ProcessRecord (pid=23306, uid=10207) requires that you obtain access using ACTION_O

应用程序崩溃并记录问题-

Caused by java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.docs.storagebackend.StorageBackendContentProvider from ProcessRecord (pid=23306, uid=10207) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
我正在使用以下代码:

   val intent = Intent()
intent.type = "image/*"
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    intent.action = Intent.ACTION_OPEN_DOCUMENT
    intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION)
} else {
    intent.action = Intent.ACTION_GET_CONTENT
}
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)

//Make sure to only display images that can be opened as an inputstream so we can upload them
intent.addCategory(Intent.CATEGORY_OPENABLE)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
}

startActivityForResult(intent, requestCode)
JobIntent
服务中使用的内容解析程序:

contentResolver.openInputStream(uri)

我们如何解决此问题?

在执行操作之前,您可能没有等待许可请求的答复?@JoachimHaglund我正在使用JobIntent服务在后台上载图像,崩溃点是contentResolver。openInputStream(uri)检查此错误原因!我使用仅用于选定图像的图库,但显示com.google.android.apps.docs.storagebackend文档时出错??