Wipe exported disk files on background threads

This commit is contained in:
Matéo Duparc 2024-11-11 19:32:18 +01:00
parent b477272d65
commit 2d5f5a82c9
Signed by: hardcoresushi
GPG Key ID: AFE384344A45E13A

View File

@ -9,6 +9,8 @@ import android.system.Os
import android.util.Log import android.util.Log
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import sushi.hardcore.droidfs.filesystems.EncryptedVolume import sushi.hardcore.droidfs.filesystems.EncryptedVolume
import sushi.hardcore.droidfs.util.Compat import sushi.hardcore.droidfs.util.Compat
@ -86,9 +88,11 @@ class EncryptedFileProvider(context: Context) {
} }
override fun free() { override fun free() {
GlobalScope.launch(Dispatchers.IO) {
Wiper.wipe(file) Wiper.wipe(file)
} }
} }
}
class ExportedMemFile private constructor(path: String, private val file: MemFile) : class ExportedMemFile private constructor(path: String, private val file: MemFile) :
ExportedFile(path) { ExportedFile(path) {