bmx666 / android-appcachecleaner

Android Cache Cleaner
GNU Affero General Public License v3.0
444 stars 32 forks source link

get cache size of apps for the custom list #223

Closed Knirps1 closed 6 months ago

Knirps1 commented 6 months ago

Since version 1.10.8 (earliest version with this bug in fdroid repo, last known working version is 1.10.5), the sum at the end always shows 0KB. Despite me knowing there were over 200 MB cleaned.

It is still the case on 1.11.1 and all versions in between.

This is on Android 10 (Nokia 6.1) photo_2024-03-27_17-08-02

bmx666 commented 6 months ago

Hi @Knirps1

Could you please verify and confirm that cleaned apps don't restore their cache back? Read my comment here -> https://github.com/bmx666/android-appcachecleaner/issues/214#issuecomment-1997773210

Knirps1 commented 6 months ago

I just checked with the youtube app and that went from 78.22 MB directly before to 1.63 MB directly after cleaning. It still showed 0KB cleaned.

TripleEYE commented 6 months ago

I can confirm that this is true even after the latest update version 1.11.1, after updating the app via F-Droid (Droid-ify) and testing this just moments ago.

EDIT: Confirmation of actual data deletion in the system (despite Cache Cleaner showing 0KB deleted) was done by checking full system-wide free-space before, and then again after, the usage of Cache Cleaner. This system-wide free-space test was done via the DiskUsage app (https://f-droid.org/packages/com.google.android.diskusage/).

Knirps1 commented 6 months ago

I did some testing and it turns out, this only happens with custom lists.

bmx666 commented 6 months ago

I did some testing and it turns out, this only happens with custom lists.

Yes, get cache size of apps is expensive IO operation, especially on old phones. The Cache Cleaner set as NULL cache size for all apps and pass list of package names associated with custom list into service and it opens App Info and do cleaning process. After returning back to main screen it checks that cache size is NULL and return 0.

bmx666 commented 6 months ago

I can confirm that this is true even after the latest update version 1.11.1, after updating the app via F-Droid (Droid-ify) and testing this just moments ago.

EDIT: Confirmation of actual data deletion in the system (despite Cache Cleaner showing 0KB deleted) was done by checking full system-wide free-space before, and then again after, the usage of Cache Cleaner. This system-wide free-space test was done via the DiskUsage app (https://f-droid.org/packages/com.google.android.diskusage/).

Please take as note, when you pressing "Clean Cache" button, Android doesn't clean cache immediately, it creates a list of background tasks to clean cache later and update statistic with delay. That's why you can get 0Kb in total, because Android returns the same statistic for app and background task is not finished yet, or not updated statistics yet. And if Cache Cleaner got from Android it's 200Mb then after cleaning process has been finished it still could be 200Mb reported by Android, but right after Android will update it.

Knirps1 commented 6 months ago

For me it is consistently every time since version 1.10.8. I downgraded for testing and went up version by version in the fdroid archive repo. Every time I cleared the same custom list and would get the cache from fdroid (the cache cleaner apk) reported as cleaned and with version 1.10.8 it started to report 0KB every time. I used the same list for months and it never showed 0KB and it has only shown 0KB for weeks with at least daily usage.

TripleEYE commented 6 months ago

As @Knirps1 mentioned (thanks for testing btw), and also from my personal experience, this used to work just fine (even in lists, as far as I can recall). So ok I understand now why it happens, but it worked before so can't it work again? Otherwise I recommend at the very least putting a pop-up message warning of this together with the list-selection screen. Though I personally think the cleaned cache being shown is a vital part of the user experience.

bmx666 commented 6 months ago

Hi @Knirps1, performance update was made since v1.11.0. All slow operations were dropped for the custom list. I could return these logic back, but you can imagine that someone select 200+ apps for the custom list and Cache cleaner starts calculate size of apps around 10s (on modern devices) and up to 1 minute on old smartphones. So there's no good or bad option.

Knirps1 commented 6 months ago

Where the slow operations dropped with 1.11.0 or before that? What I'm describing happens since before that version. If you don't want to revert the drop of slow operations, it should be possible to test for it and change the message shown. Another possibility that takes more effort is to put it into a setting and let the user decide. I understand if you don't pursue this option.

bmx666 commented 6 months ago

Hi @Knirps1 , please update on v1.11.2

Knirps1 commented 6 months ago

It works again and the time it took with a list of 12 apps wasn't really noticeable. Thank you

TripleEYE commented 6 months ago

I will wait until the update appears on Droid-ify, but I'm so excited it works again. Thank you @bmx666! 🙏

EDIT: Can confirm that it works and with over 30 apps on my list it really doesn't take that long 👍 👍