bmx666 / android-appcachecleaner

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

[feature request] support root mode #243

Closed Mahantor closed 1 month ago

Mahantor commented 1 month ago

Please add root mode to the app for rooted phones

TPS commented 1 month ago

@Mahantor https://github.com/bmx666/android-appcachecleaner/issues/198#issuecomment-1927436951

@bmx666 Maybe Shizuku support instead/also?

bmx666 commented 1 month ago

Hi @TPS @Mahantor

What is your suggestion? If you plan to avoid using Accessibility Service, then Cache Cleaner is not suitable for that. The main purpose of Cache Cleaner is to perform clicks, nothing more. If you want to call or execute root commands that run in the background, then this concept doesn't fit.

TPS commented 1 month ago

@bmx666 More than simply avoiding the A11y Service, it's about speed. Using adb (Shizuku)/root for these functions can accomplish in seconds what would typically take minutes. Waiting for 1's device to perform maintenance is boring, & this would help ameliorate that.

bmx666 commented 1 month ago

In that case, I suppose couldn't provide any solution without external support from other maintainers that could develop app and focus on root mode feature. Maybe PR would be helpful, but it's out of my scope.

TPS commented 1 month ago

@bmx666 Unfortunately, I'm no Android developer. In case you or anyone'd like to take a look, I linked the Shizuku (& SUI) API above. Perhaps it'd be a good start point?

bmx666 commented 1 month ago

@TPS not really, it takes a lot of effort to integrate just their API into app itself.

bmx666 commented 1 month ago

Please have a look into https://github.com/bmx666/android-appcachecleaner/issues/250#issuecomment-2267487934

I think Magisk module is the best option for your cases.

TPS commented 1 month ago

Magisk also requires root, while Shizuku runs via adb w/o needing that. Maybe leave this open for potential PR?

bmx666 commented 1 month ago

@TPS if you have access to adb with root access, or any Terminal app with root access then just type in shell

    # Search and clear the apps cache in the "/data/data" directory
    find /data/data/*/cache/* -delete &>/dev/null
    # Search and clear the apps code_cache in the "/data/data" directory
    find /data/data/*/code_cache/* -delete &>/dev/null
    # Search and clear the apps cache in the "/data/user_de/{UID}" directory
    find /data/user_de/*/*/cache/* -delete &>/dev/null
    # Search and clear the apps code_cache in the "/data/user_de/{UID}" directory
    find /data/user_de/*/*/code_cache/* -delete &>/dev/null
    # Search and clear the apps cache in the "/sdcard/Android/data" directory
    find /sdcard/Android/data/*/cache/* -delete &>/dev/null

If you have find util from Toybox only

    # Search and clear the apps cache in the "/data/data" directory
    find /data/data -path '*/cache/*' -delete &>/dev/null
    # Search and clear the apps code_cache in the "/data/data" directory
    find /data/data -path '*/code_cache/*' -delete &>/dev/null
    # Search and clear the apps cache in the "/data/user_de/{UID}" directory
    find /data/user_de -path '*/*/cache/*' -delete &>/dev/null
    # Search and clear the apps code_cache in the "/data/user_de/{UID}" directory
    find /data/user_de -path '*/*/code_cache/*' -delete &>/dev/null
    # Search and clear the apps cache in the "/sdcard/Android/data" directory
    find /sdcard/Android/data -path '*/cache/*' -delete &>/dev/null
TPS commented 1 month ago

If 1 were to have root/sui, 1 doesn't need adb/Shizuku. The latter is a way to achieve many functions sans root that're not otherwise available, such as many filesys ops.