Skip to content

Commit

Permalink
Remove cleanup requirement for storage permission
Browse files Browse the repository at this point in the history
We're able to write directly to the Downloads folder (tested on API 33) so there's no reason to check for storage permission when trying to cleanup, we instead just check if we can actually write to that directory and if not we don't cleanup.

This is related to #2415
  • Loading branch information
pyricau committed Nov 10, 2022
1 parent e306e5c commit 4d6e0b8
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -44,8 +44,9 @@ internal class LeakDirectoryProvider constructor(
private val context: Context = context.applicationContext

fun listFiles(filter: FilenameFilter): MutableList<File> {
if (!hasStoragePermission() && requestExternalStoragePermission()) {
requestWritePermissionNotification()
val externalStorageDirectory = externalStorageDirectory()
if (!externalStorageDirectory.exists() || !externalStorageDirectory.canWrite()) {
return mutableListOf()
}
val files = ArrayList<File>()

Expand Down

0 comments on commit 4d6e0b8

Please sign in to comment.