d4rken-org / sdmaid-se

SD Maid 2/SE is Android's most thorough cleaning tool.
https://play.google.com/store/apps/details?id=eu.darken.sdmse
GNU General Public License v3.0
2.6k stars 395 forks source link

AppCleaner deletion fails due to `chattr +i` #1332

Closed zhangweildlh closed 1 month ago

zhangweildlh commented 1 month ago

 Describe the bug

  1. Click on 'AppCleaner'button
  2. Click on 'Delete' button
  3. Can successfully complete the scan; After clicking the 'delete' button, the deletion of junk files appears to be completed on the surface. The junk files were not actually deleted.  Expected behavior I hope to successfully clean up the 'App junk files'  Smartphone (please complete the following information):
    • Device: [e.g. Pixel 9] Xiaomi Redmi Note 12Turbo
    • OS: [e.g. Android 17] Xiaomi HyperOS 1.0.3.0 ( Android 14)
    • Root status [e.g. Rooted - Magisk v25.2] 27.0(27000)
    • SD Maid 2/SE version [e.g. v0.6.6-rc6] 1.2.1-rc0  Debug log debug-log:eu.darken.sdmse_logfile_1722183160462 eu.darken.sdmse_logfile_1722183160462.zip

 Screenshots/Video If applicable, add screenshots or a video if it helps to explain your problem. Screenshots.zip

d4rken commented 1 month ago

Dupe of #1331 1331

d4rken commented 1 month ago

Nvm, not a dupe, this is about AppCleaner.

d4rken commented 1 month ago

That's an interesting issue.

The deletion fails because one file could not be deleted:

2024-07-28T16:16:49.406Z  E/SDMSE:AppCleaner: Deletion failed for class eu.darken.sdmse.appcleaner.core.forensics.filter.DefaultCachesPublicFilter at NormalPkg(packageName=com.tencent.mm, userHandle=UserHandle2(handleId=0)): eu.darken.sdmse.common.files.WriteException: Can't write to path. <-> /storage/emulated/0/Android/data/com.tencent.mm/cache/download/UUID

This can happen, e.g. if the file is being used by the running app.

I should check if the app could be killed beforehand, I think that we have this already, with root it should work.

The error dialog with CancellationException is likely caused by the whole deletion operation being aborted due to one failed deletion, I think I'll change that to continue in that case with everything else :thinking:

zhangweildlh commented 1 month ago

/storage/emulated/0/Android/data/com.tencent.mm/cache/download/UUID

In order to defend against app advertisements, I created a UUID file (0kb) in the/storage/emullated/0/Android/data/com. tencent.mm/cache/download folder and processed the file using "chattr +i" Suggestion: Can sdmaid se skip files (folders) that cannot be deleted?

d4rken commented 1 month ago

Similar to #916, yeah skipping this seems like a good option.

They will still show in your scan results, as undeletable items, to solve that you will still need an exclusion.

zhangweildlh commented 1 month ago

Similar to #916, yeah skipping this seems like a good option.

They will still show in your scan results, as undeletable items, to solve that you will still need an exclusion.

May I ask how to exclude it? I don't know how to set it up

DRYN07 commented 1 month ago

I have similar issue, it takes more than an hour it to run and it does not delete anything :/ Is there a global solution for it yet or should I share my log?

d4rken commented 1 month ago

Similar to #916, yeah skipping this seems like a good option. They will still show in your scan results, as undeletable items, to solve that you will still need an exclusion.

May I ask how to exclude it? I don't know how to set it up

Select the item in the results, long press it and pick exclude.

I have similar issue, it takes more than an hour it to run and it does not delete anything :/ Is there a global solution for it yet or should I share my log?

Similar as in you also created undeletable files with something like chattr +i? If so yes please provide a debug log here. If it's not that, e.g. it takes long because accessibility service loops, then please open a new ticket for your issue.

DRYN07 commented 1 month ago

Thanks

eu.darken.sdmse_logfile_1722496739146.zip

d4rken commented 1 month ago

Thanks

eu.darken.sdmse_logfile_1722496739146.zip

@DRYN07 You did the exact opposite of what I asked :slightly_frowning_face:

You didn't make any chattr +i modifications, the log shows that the AppCleaner loops. Looks like an issue with multiple system languages en and hu.