Fix SecurityException when importing from exposed volume
This commit is contained in:
parent
7c72c4e829
commit
4b002c7b24
@ -68,7 +68,11 @@ class ExplorerActivity : BaseExplorerActivity() {
|
|||||||
private val pickFiles = registerForActivityResult(ActivityResultContracts.OpenMultipleDocuments()) { uris ->
|
private val pickFiles = registerForActivityResult(ActivityResultContracts.OpenMultipleDocuments()) { uris ->
|
||||||
if (uris != null) {
|
if (uris != null) {
|
||||||
for (uri in uris) {
|
for (uri in uris) {
|
||||||
|
try {
|
||||||
contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
||||||
|
} catch (e: SecurityException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
importFilesFromUris(uris) {
|
importFilesFromUris(uris) {
|
||||||
onImportComplete(uris)
|
onImportComplete(uris)
|
||||||
|
Loading…
Reference in New Issue
Block a user