diff --git a/app-common-io/src/main/aidl/eu/darken/sdmse/common/files/local/ipc/FileOpsConnection.aidl b/app-common-io/src/main/aidl/eu/darken/sdmse/common/files/local/ipc/FileOpsConnection.aidl index 4749c847f..fd8d3b382 100644 --- a/app-common-io/src/main/aidl/eu/darken/sdmse/common/files/local/ipc/FileOpsConnection.aidl +++ b/app-common-io/src/main/aidl/eu/darken/sdmse/common/files/local/ipc/FileOpsConnection.aidl @@ -21,7 +21,7 @@ interface FileOpsConnection { boolean exists(in LocalPath path); - boolean delete(in LocalPath path); + boolean delete(in LocalPath path, boolean recursive, boolean dryRun); RemoteInputStream listFilesStream(in LocalPath path); diff --git a/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathExtensions.kt b/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathExtensions.kt index cb27dc518..04b51428b 100644 --- a/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathExtensions.kt +++ b/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathExtensions.kt @@ -107,13 +107,18 @@ suspend fun T.createDirIfNecessary(gateway: APathGateway T.delete(gateway: APathGateway, out APathLookupExtended>) { - gateway.delete(this) - log(VERBOSE) { "APath.delete(): Deleted $this" } +suspend fun T.delete( + gateway: APathGateway, out APathLookupExtended>, + recursive: Boolean = false, +) { + gateway.delete( + this, + recursive = recursive + ) + log(VERBOSE) { "APath.delete(recursive=$recursive): Deleted $this" } } -// TODO move this into the gateways? -suspend fun T.deleteAll( +suspend fun T.deleteWalk( gateway: APathGateway, out APathLookupExtended>, filter: (APathLookup<*>) -> Boolean = { true } ) { @@ -122,7 +127,7 @@ suspend fun T.deleteAll( if (lookup.isDirectory) { gateway.listFiles(this).forEach { - it.deleteAll(gateway, filter) // Recursion enter + it.deleteWalk(gateway, filter) // Recursion enter } } @@ -141,7 +146,7 @@ suspend fun T.deleteAll( } // Recursion exit - this.delete(gateway) + this.delete(gateway, recursive = false) } suspend fun T.file( diff --git a/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathGateway.kt b/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathGateway.kt index ff39e720b..26785a841 100644 --- a/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathGateway.kt +++ b/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathGateway.kt @@ -54,7 +54,7 @@ interface APathGateway< suspend fun file(path: P, readWrite: Boolean): FileHandle - suspend fun delete(path: P) + suspend fun delete(path: P, recursive: Boolean) suspend fun createSymlink(linkPath: P, targetPath: P): Boolean diff --git a/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathLookupExtensions.kt b/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathLookupExtensions.kt index 2429118aa..4b6416caa 100644 --- a/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathLookupExtensions.kt +++ b/app-common-io/src/main/java/eu/darken/sdmse/common/files/APathLookupExtensions.kt @@ -1,7 +1,5 @@ package eu.darken.sdmse.common.files -import eu.darken.sdmse.common.debug.logging.Logging.Priority.VERBOSE -import eu.darken.sdmse.common.debug.logging.log import kotlinx.coroutines.flow.Flow import okio.FileHandle @@ -30,16 +28,17 @@ suspend fun

> PL.exists( ): Boolean = lookedUp.exists(gateway) suspend fun

, PLE : APathLookupExtended

> PL.delete( - gateway: APathGateway -) { - lookedUp.delete(gateway) - log(VERBOSE) { "APath.delete(): Deleted $this" } -} - -suspend fun

> PL.deleteAll( + gateway: APathGateway, + recursive: Boolean = false, +) = lookedUp.delete( + gateway, + recursive = recursive +) + +suspend fun

> PL.deletewalk( gateway: APathGateway, out APathLookupExtended

>, filter: (APathLookup<*>) -> Boolean = { true } -) = lookedUp.deleteAll(gateway, filter) +) = lookedUp.deleteWalk(gateway, filter) suspend fun

> PL.file( gateway: APathGateway, out APathLookupExtended

>, diff --git a/app-common-io/src/main/java/eu/darken/sdmse/common/files/GatewaySwitch.kt b/app-common-io/src/main/java/eu/darken/sdmse/common/files/GatewaySwitch.kt index 3158d8db4..350011997 100644 --- a/app-common-io/src/main/java/eu/darken/sdmse/common/files/GatewaySwitch.kt +++ b/app-common-io/src/main/java/eu/darken/sdmse/common/files/GatewaySwitch.kt @@ -182,8 +182,8 @@ class GatewaySwitch @Inject constructor( return useGateway(path) { file(path, readWrite) } } - override suspend fun delete(path: APath) { - return useGateway(path) { delete(path) } + override suspend fun delete(path: APath, recursive: Boolean) { + return useGateway(path) { delete(path, recursive = recursive) } } override suspend fun createSymlink(linkPath: APath, targetPath: APath): Boolean { diff --git a/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/LocalGateway.kt b/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/LocalGateway.kt index a1ded9fd0..3f6e663ae 100644 --- a/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/LocalGateway.kt +++ b/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/LocalGateway.kt @@ -715,9 +715,17 @@ class LocalGateway @Inject constructor( } } - override suspend fun delete(path: LocalPath) = delete(path, Mode.AUTO) + override suspend fun delete(path: LocalPath, recursive: Boolean) = delete( + path, + recursive = recursive, + mode = Mode.AUTO + ) - suspend fun delete(path: LocalPath, mode: Mode = Mode.AUTO): Unit = runIO { + suspend fun delete( + path: LocalPath, + recursive: Boolean = false, + mode: Mode = Mode.AUTO + ): Unit = runIO { try { val javaFile = path.asFile() @@ -745,11 +753,16 @@ class LocalGateway @Inject constructor( mode == Mode.NORMAL || mode == Mode.AUTO && normalCanWrite -> { log(TAG, VERBOSE) { "delete($mode->NORMAL): $path" } - var success = if (Bugs.isDryRun) { - log(TAG, INFO) { "DRYRUN: Not deleting $javaFile" } - javaFile.canWrite() - } else { - javaFile.delete() + var success = javaFile.run { + when { + Bugs.isDryRun -> { + log(TAG, INFO) { "DRYRUN: Not deleting $javaFile" } + javaFile.canWrite() + } + + recursive -> deleteRecursively() + else -> delete() + } } if (!success) { @@ -764,7 +777,7 @@ class LocalGateway @Inject constructor( if (!success) { if (mode == Mode.AUTO && hasRoot()) { - delete(path, Mode.ROOT) + delete(path, recursive = recursive, mode = Mode.ROOT) return@runIO } else { throw IOException("delete() call returned false") @@ -773,7 +786,7 @@ class LocalGateway @Inject constructor( if (!success) { if (mode == Mode.AUTO && hasShizuku()) { - delete(path, Mode.ADB) + delete(path, recursive = recursive, mode = Mode.ADB) return@runIO } else { throw IOException("delete() call returned false") @@ -784,12 +797,8 @@ class LocalGateway @Inject constructor( hasRoot() && (mode == Mode.ROOT || mode == Mode.AUTO) -> { log(TAG, VERBOSE) { "delete($mode->ROOT): $path" } rootOps { - var success = if (Bugs.isDryRun) { - log(TAG, INFO) { "DRYRUN: Not deleting (root) $javaFile" } - it.canWrite(path) - } else { - it.delete(path) - } + if (Bugs.isDryRun) log(TAG, INFO) { "DRYRUN: Not deleting (root) $javaFile" } + var success = it.delete(path, recursive = true, dryRun = Bugs.isDryRun) if (!success) { // TODO We could move this into the root service for better performance? @@ -806,12 +815,9 @@ class LocalGateway @Inject constructor( hasShizuku() && (mode == Mode.ADB || mode == Mode.AUTO) -> { log(TAG, VERBOSE) { "delete($mode->ADB): $path" } adbOps { - var success = if (Bugs.isDryRun) { - log(TAG, INFO) { "DRYRUN: Not deleting (adb) $javaFile" } - it.canWrite(path) - } else { - it.delete(path) - } + if (Bugs.isDryRun) log(TAG, INFO) { "DRYRUN: Not deleting (adb) $javaFile" } + var success = it.delete(path, recursive = true, dryRun = Bugs.isDryRun) + if (!success) { // TODO We could move this into the ADB service for better performance? diff --git a/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/ipc/FileOpsClient.kt b/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/ipc/FileOpsClient.kt index 930715657..617860b77 100644 --- a/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/ipc/FileOpsClient.kt +++ b/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/ipc/FileOpsClient.kt @@ -129,8 +129,8 @@ class FileOpsClient @AssistedInject constructor( throw e.unwrapPropagation() } - fun delete(path: LocalPath): Boolean = try { - fileOpsConnection.delete(path) + fun delete(path: LocalPath, recursive: Boolean, dryRun: Boolean): Boolean = try { + fileOpsConnection.delete(path, recursive, dryRun) } catch (e: Exception) { throw e.unwrapPropagation() } diff --git a/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/ipc/FileOpsHost.kt b/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/ipc/FileOpsHost.kt index 7ece6df0b..16c4a7597 100644 --- a/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/ipc/FileOpsHost.kt +++ b/app-common-io/src/main/java/eu/darken/sdmse/common/files/local/ipc/FileOpsHost.kt @@ -201,11 +201,17 @@ class FileOpsHost @Inject constructor( throw e.wrapToPropagate() } - override fun delete(path: LocalPath): Boolean = try { - if (Bugs.isTrace) log(TAG, VERBOSE) { "exists($path)..." } - path.asFile().delete() + override fun delete(path: LocalPath, recursive: Boolean, dryRun: Boolean): Boolean = try { + log(TAG, VERBOSE) { "delete($path,recursive=$recursive,dryRun=$dryRun)..." } + path.asFile().run { + when { + dryRun -> canWrite() + recursive -> deleteRecursively() + else -> delete() + } + } } catch (e: Exception) { - log(TAG, ERROR) { "delete(path=$path) failed\n${e.asLog()}" } + log(TAG, ERROR) { "delete(path=$path,recursive=$recursive,dryRun=$dryRun) failed\n${e.asLog()}" } throw e.wrapToPropagate() } @@ -241,12 +247,6 @@ class FileOpsHost @Inject constructor( throw e.wrapToPropagate() } - // Not all exception can be passed through the binder - // See Parcel.writeException(...) - private fun wrapPropagating(e: Exception): Exception { - return if (e is RuntimeException) e else RuntimeException(e) - } - companion object { val TAG = logTag("FileOps", "Service", "Host", Bugs.processTag) } diff --git a/app-common-io/src/main/java/eu/darken/sdmse/common/files/saf/SAFGateway.kt b/app-common-io/src/main/java/eu/darken/sdmse/common/files/saf/SAFGateway.kt index 4bc38b8be..fe8f71e14 100644 --- a/app-common-io/src/main/java/eu/darken/sdmse/common/files/saf/SAFGateway.kt +++ b/app-common-io/src/main/java/eu/darken/sdmse/common/files/saf/SAFGateway.kt @@ -158,21 +158,44 @@ class SAFGateway @Inject constructor( } } - override suspend fun delete(path: SAFPath) = runIO { - try { - val docFile = findDocFile(path) - log(TAG, VERBOSE) { "delete(): $path -> $docFile" } + suspend fun delete(path: SAFPath) = delete(path, recursive = false) - var success = docFile.delete() + override suspend fun delete(path: SAFPath, recursive: Boolean) = runIO { - if (!success) { - success = !docFile.exists - if (success) log(TAG, WARN) { "Tried to delete file, but it's already gone: $path" } - } + log(TAG, VERBOSE) { "delete(recursive=$recursive): $path" } - if (!success) throw IOException("Document delete() call returned false") - } catch (e: Exception) { - throw WriteException(path = path, cause = e) + val queue = LinkedList(listOf(lookup(path))) + + while (!queue.isEmpty()) { + val lookUp = queue.removeFirst() + + if (lookUp.isDirectory) { + val newBatch = try { + lookupFiles(lookUp.lookedUp) + } catch (e: IOException) { + log(TAG, ERROR) { "Failed to read directory to delete $lookUp: $e" } + throw ReadException(path = path, cause = e) + } + queue.addAll(newBatch) + } else { + var success = try { + lookUp.docFile.delete() + } catch (e: Exception) { + throw WriteException(path = path, cause = e) + } + + if (!success) { + success = try { + !lookUp.docFile.exists + } catch (e: IOException) { + log(TAG, ERROR) { "Failed to perform exists() check $lookUp: $e" } + throw ReadException(path = path, cause = e) + } + if (success) log(TAG, WARN) { "Tried to delete file, but it's already gone: $path" } + } + + if (!success) throw IOException("Document delete() call returned false") + } } } diff --git a/app/src/main/java/eu/darken/sdmse/analyzer/core/Analyzer.kt b/app/src/main/java/eu/darken/sdmse/analyzer/core/Analyzer.kt index 8e08186f5..0677605ce 100644 --- a/app/src/main/java/eu/darken/sdmse/analyzer/core/Analyzer.kt +++ b/app/src/main/java/eu/darken/sdmse/analyzer/core/Analyzer.kt @@ -27,7 +27,7 @@ import eu.darken.sdmse.common.debug.logging.Logging.Priority.WARN import eu.darken.sdmse.common.debug.logging.log import eu.darken.sdmse.common.debug.logging.logTag import eu.darken.sdmse.common.files.GatewaySwitch -import eu.darken.sdmse.common.files.deleteAll +import eu.darken.sdmse.common.files.delete import eu.darken.sdmse.common.files.filterDistinctRoots import eu.darken.sdmse.common.files.isAncestorOf import eu.darken.sdmse.common.files.matches @@ -188,7 +188,7 @@ class Analyzer @Inject constructor( .forEach { target -> log(TAG) { "Deleting $target" } updateProgressSecondary(target.userReadablePath) - target.deleteAll(gatewaySwitch) + target.delete(gatewaySwitch, recursive = true) } // TODO this seems convoluted, can we come up with a better data pattern? diff --git a/app/src/main/java/eu/darken/sdmse/appcleaner/core/AppCleaner.kt b/app/src/main/java/eu/darken/sdmse/appcleaner/core/AppCleaner.kt index a875e5868..aaa270626 100644 --- a/app/src/main/java/eu/darken/sdmse/appcleaner/core/AppCleaner.kt +++ b/app/src/main/java/eu/darken/sdmse/appcleaner/core/AppCleaner.kt @@ -230,9 +230,11 @@ class AppCleaner @Inject constructor( val filter = filters.singleOrNull { it.identifier == filterIdentifier } ?: throw IllegalStateException("Can't find filter for $filterIdentifier") + updateProgressSecondary(eu.darken.sdmse.common.R.string.general_progress_loading) + filter.withProgress( client = this, - onUpdate = { old, new -> old?.copy(secondary = new?.secondary ?: CaString.EMPTY) }, + onUpdate = { old, new -> old?.copy(secondary = new?.primary ?: CaString.EMPTY) }, onCompletion = { it } ) { val result = process(targets, allMatches) diff --git a/app/src/main/java/eu/darken/sdmse/appcleaner/core/forensics/BaseExpendablesFilter.kt b/app/src/main/java/eu/darken/sdmse/appcleaner/core/forensics/BaseExpendablesFilter.kt index 191ded95d..2589d8c6d 100644 --- a/app/src/main/java/eu/darken/sdmse/appcleaner/core/forensics/BaseExpendablesFilter.kt +++ b/app/src/main/java/eu/darken/sdmse/appcleaner/core/forensics/BaseExpendablesFilter.kt @@ -10,13 +10,15 @@ import eu.darken.sdmse.common.debug.logging.logTag import eu.darken.sdmse.common.files.APathLookup import eu.darken.sdmse.common.files.GatewaySwitch import eu.darken.sdmse.common.files.PathException -import eu.darken.sdmse.common.files.deleteAll +import eu.darken.sdmse.common.files.delete import eu.darken.sdmse.common.files.exists import eu.darken.sdmse.common.files.filterDistinctRoots import eu.darken.sdmse.common.files.isAncestorOf import eu.darken.sdmse.common.flow.throttleLatest import eu.darken.sdmse.common.progress.Progress -import eu.darken.sdmse.common.progress.updateProgressSecondary +import eu.darken.sdmse.common.progress.increaseProgress +import eu.darken.sdmse.common.progress.updateProgressCount +import eu.darken.sdmse.common.progress.updateProgressPrimary import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow @@ -35,6 +37,7 @@ abstract class BaseExpendablesFilter : ExpendablesFilter { allMatches: Collection, ): ExpendablesFilter.ProcessResult { log(TAG, INFO) { "deleteAll(...) Processing ${targets.size} out of ${allMatches.size} matches" } + updateProgressPrimary(eu.darken.sdmse.common.R.string.general_progress_preparing) val successful = mutableSetOf() val failed = mutableSetOf>() @@ -42,19 +45,21 @@ abstract class BaseExpendablesFilter : ExpendablesFilter { if (distinctRoots.size != targets.size) { log(TAG, INFO) { "${targets.size} match objects but only ${distinctRoots.size} distinct roots" } - if (Bugs.isDebug) { + if (Bugs.isTrace) { targets .filter { !distinctRoots.contains(it.lookup) } .forEachIndexed { index, item -> log(TAG, INFO) { "Non distinct root #$index: $item" } } } } + updateProgressCount(Progress.Count.Percent(distinctRoots.size)) + distinctRoots.forEach { targetRoot -> - updateProgressSecondary(targetRoot.userReadablePath) + updateProgressPrimary(targetRoot.userReadablePath) val main = targets.first { it.lookup == targetRoot } val mainDeleted = try { - targetRoot.deleteAll(gatewaySwitch) + targetRoot.delete(gatewaySwitch, recursive = true) log(TAG) { "Main match deleted: $main" } true } catch (oge: PathException) { @@ -76,7 +81,7 @@ abstract class BaseExpendablesFilter : ExpendablesFilter { // deleteAll(...) starts at leafs, children may have been deleted, even if the top-level dir wasn't val affected = allMatches.filter { it != main && main.lookup.isAncestorOf(it.lookup) } - if (Bugs.isDebug) { + if (Bugs.isTrace) { log(TAG) { "$main affects ${affected.size} other matches" } affected.forEach { log(TAG, VERBOSE) { "Affected: $it" } } } @@ -96,6 +101,7 @@ abstract class BaseExpendablesFilter : ExpendablesFilter { } } } + increaseProgress() } return ExpendablesFilter.ProcessResult( diff --git a/app/src/main/java/eu/darken/sdmse/appcleaner/core/tasks/AppCleanerProcessingTask.kt b/app/src/main/java/eu/darken/sdmse/appcleaner/core/tasks/AppCleanerProcessingTask.kt index 9cbeaf6b8..5bfa5073b 100644 --- a/app/src/main/java/eu/darken/sdmse/appcleaner/core/tasks/AppCleanerProcessingTask.kt +++ b/app/src/main/java/eu/darken/sdmse/appcleaner/core/tasks/AppCleanerProcessingTask.kt @@ -46,5 +46,9 @@ data class AppCleanerProcessingTask( Formatter.formatFileSize(this, affectedSpace) ) } + + override fun toString(): String { + return "AppCleanerProcessingTask.Success($affectedSpace,${affectedPaths.size} items)" + } } } \ No newline at end of file diff --git a/app/src/main/java/eu/darken/sdmse/appcontrol/core/uninstall/Uninstaller.kt b/app/src/main/java/eu/darken/sdmse/appcontrol/core/uninstall/Uninstaller.kt index a297e2f97..de23f0ffb 100644 --- a/app/src/main/java/eu/darken/sdmse/appcontrol/core/uninstall/Uninstaller.kt +++ b/app/src/main/java/eu/darken/sdmse/appcontrol/core/uninstall/Uninstaller.kt @@ -87,7 +87,7 @@ class Uninstaller @Inject constructor( } else -> { - log(TAG) { "Using normal instant to uninstall $installId" } + log(TAG) { "Using normal intent to uninstall $installId" } val appSettingsIntent = Intent(Intent.ACTION_DELETE).apply { data = Uri.parse("package:${installId.pkgId.name}") addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) diff --git a/app/src/main/java/eu/darken/sdmse/automation/core/AutomationService.kt b/app/src/main/java/eu/darken/sdmse/automation/core/AutomationService.kt index 669ca1eda..019825ca1 100644 --- a/app/src/main/java/eu/darken/sdmse/automation/core/AutomationService.kt +++ b/app/src/main/java/eu/darken/sdmse/automation/core/AutomationService.kt @@ -199,7 +199,6 @@ class AutomationService : AccessibilityService(), AutomationHost, Progress.Host, } override fun onAccessibilityEvent(event: AccessibilityEvent) { - log(TAG, VERBOSE) { "onAccessibilityEvent(eventType=${event.eventType})" } if (!checkLaunch()) return if (generalSettings.hasAcsConsent.valueBlocking != true) { @@ -209,6 +208,8 @@ class AutomationService : AccessibilityService(), AutomationHost, Progress.Host, if (!automationProcessor.hasTask) return + log(TAG, VERBOSE) { "onAccessibilityEvent(eventType=${event.eventType})" } + val eventCopy = if (hasApiLevel(30)) { @Suppress("NewApi") AccessibilityEvent(event) diff --git a/app/src/main/java/eu/darken/sdmse/corpsefinder/core/CorpseFinder.kt b/app/src/main/java/eu/darken/sdmse/corpsefinder/core/CorpseFinder.kt index 352469296..728cf7f93 100644 --- a/app/src/main/java/eu/darken/sdmse/corpsefinder/core/CorpseFinder.kt +++ b/app/src/main/java/eu/darken/sdmse/corpsefinder/core/CorpseFinder.kt @@ -16,7 +16,7 @@ import eu.darken.sdmse.common.debug.logging.logTag import eu.darken.sdmse.common.files.APath import eu.darken.sdmse.common.files.GatewaySwitch import eu.darken.sdmse.common.files.WriteException -import eu.darken.sdmse.common.files.deleteAll +import eu.darken.sdmse.common.files.delete import eu.darken.sdmse.common.files.filterDistinctRoots import eu.darken.sdmse.common.files.isAncestorOf import eu.darken.sdmse.common.files.matches @@ -288,13 +288,10 @@ class CorpseFinder @Inject constructor( ) }) log(TAG) { "Deleting $targetContent..." } + updateProgressSecondary(targetContent.userReadablePath) try { - targetContent.deleteAll(gatewaySwitch) { - updateProgressSecondary(it.userReadablePath) - true - } + targetContent.delete(gatewaySwitch, recursive = true) log(TAG) { "Deleted $targetContent!" } - deleted.add(targetContent) } catch (e: WriteException) { log(TAG, WARN) { "Deletion failed for $targetContent: $e" } @@ -312,7 +309,7 @@ class CorpseFinder @Inject constructor( log(TAG) { "Deleting $targetCorpse..." } updateProgressSecondary(corpse.lookup.userReadablePath) try { - corpse.lookup.deleteAll(gatewaySwitch) + corpse.lookup.delete(gatewaySwitch, recursive = true) log(TAG) { "Deleted $targetCorpse!" } deletedCorpses.add(corpse) } catch (e: WriteException) { diff --git a/app/src/main/java/eu/darken/sdmse/systemcleaner/core/filter/BaseSystemCleanerFilter.kt b/app/src/main/java/eu/darken/sdmse/systemcleaner/core/filter/BaseSystemCleanerFilter.kt index 92b568b9e..82271b0e4 100644 --- a/app/src/main/java/eu/darken/sdmse/systemcleaner/core/filter/BaseSystemCleanerFilter.kt +++ b/app/src/main/java/eu/darken/sdmse/systemcleaner/core/filter/BaseSystemCleanerFilter.kt @@ -1,7 +1,7 @@ package eu.darken.sdmse.systemcleaner.core.filter import eu.darken.sdmse.common.files.GatewaySwitch -import eu.darken.sdmse.common.files.deleteAll +import eu.darken.sdmse.common.files.delete import eu.darken.sdmse.common.files.filterDistinctRoots import eu.darken.sdmse.common.flow.throttleLatest import eu.darken.sdmse.common.progress.Progress @@ -29,7 +29,7 @@ abstract class BaseSystemCleanerFilter : SystemCleanerFilter { .also { updateProgressCount(Progress.Count.Percent(it.size)) } .forEach { targetContent -> updateProgressPrimary(targetContent.userReadablePath) - targetContent.deleteAll(gatewaySwitch) + targetContent.delete(gatewaySwitch, recursive = true) increaseProgress() } } \ No newline at end of file diff --git a/app/src/test/java/eu/darken/sdmse/deduplicator/core/DuplicatesDeleterTest.kt b/app/src/test/java/eu/darken/sdmse/deduplicator/core/DuplicatesDeleterTest.kt index a57e4ba20..d5e653bc8 100644 --- a/app/src/test/java/eu/darken/sdmse/deduplicator/core/DuplicatesDeleterTest.kt +++ b/app/src/test/java/eu/darken/sdmse/deduplicator/core/DuplicatesDeleterTest.kt @@ -20,7 +20,7 @@ import testhelpers.BaseTest class DuplicatesDeleterTest : BaseTest() { private val gatewaySwitch: GatewaySwitch = mockk().apply { - coEvery { delete(any()) } returns Unit + coEvery { delete(any(), any()) } returns Unit } private val arbiter: DuplicatesArbiter = mockk().apply { coEvery { decideGroups(any()) } answers {