openUri: adjust code to avoid SecurityException in rare cases
This commit is contained in:
@@ -439,7 +439,7 @@ class MainActivity : ComponentActivity() {
|
||||
val openIntent = Intent(Intent.ACTION_VIEW).apply {
|
||||
setDataAndType(uriToOpen, mimeType)
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
clipData = ClipData.newRawUri(null, uriToOpen)
|
||||
clipData = ClipData.newUri(contentResolver, "file", uriToOpen)
|
||||
}
|
||||
val chooser = Intent.createChooser(openIntent, getString(R.string.open_file)).apply {
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
|
||||
Reference in New Issue
Block a user