Merge pull request #75146 from m4gr3d/fix_directory_access_with_all_files_access_permission_main
Fix directory access when the running app has the `All files access` permission
This commit is contained in:
commit
0067578b5b
1 changed files with 8 additions and 1 deletions
|
@ -76,6 +76,13 @@ internal enum class StorageScope {
|
||||||
return UNKNOWN
|
return UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have 'All Files Access' permission, we can access all directories without
|
||||||
|
// restriction.
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R
|
||||||
|
&& Environment.isExternalStorageManager()) {
|
||||||
|
return APP
|
||||||
|
}
|
||||||
|
|
||||||
val canonicalPathFile = pathFile.canonicalPath
|
val canonicalPathFile = pathFile.canonicalPath
|
||||||
|
|
||||||
if (internalAppDir != null && canonicalPathFile.startsWith(internalAppDir)) {
|
if (internalAppDir != null && canonicalPathFile.startsWith(internalAppDir)) {
|
||||||
|
@ -90,7 +97,7 @@ internal enum class StorageScope {
|
||||||
return APP
|
return APP
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootDir: String? = System.getenv("ANDROID_ROOT")
|
val rootDir: String? = System.getenv("ANDROID_ROOT")
|
||||||
if (rootDir != null && canonicalPathFile.startsWith(rootDir)) {
|
if (rootDir != null && canonicalPathFile.startsWith(rootDir)) {
|
||||||
return APP
|
return APP
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue