Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed Jan 19, 2023
1 parent 5157992 commit f37ebc5
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,8 @@ class PermissionActivity : AppCompatActivity() {
//所有文件所有文件的管理权限
Request.TYPE_MANAGE_ALL_FILES_ACCESS_PERMISSION -> try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
kotlin.runCatching {
val settingIntent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
settingIntent.data = Uri.parse("package:$packageName")
settingActivityResult.launch(settingIntent)
}.onFailure {
val settingIntent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
settingActivityResult.launch(settingIntent)
}
val settingIntent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
settingActivityResult.launch(settingIntent)
} else {
throw NoStackTraceException("no MANAGE_ALL_FILES_ACCESS_PERMISSION")
}
Expand Down

0 comments on commit f37ebc5

Please sign in to comment.