android-appcachecleaner icon indicating copy to clipboard operation
android-appcachecleaner copied to clipboard

[feature request] add a widget to clear the cache

Open mrtaxi opened this issue 2 years ago • 3 comments

Hi! Thank you for your work! Is it possible to add a widget to clear the cache of all applications for rooted devices?

mrtaxi avatar Dec 20 '22 21:12 mrtaxi

Hi @mrtaxi You can clear the cache of all user and system apps without root. The problem is only here #21 and I have no idea how to solve it. Also I have never created widgets before 🙈

bmx666 avatar Dec 20 '22 23:12 bmx666

Thank you in any case 🙂

mrtaxi avatar Dec 20 '22 23:12 mrtaxi

Hi @mrtaxi, I finally did some research and made a PoC solution for the widget. However, I encountered an issue with the Accessibility Service. It doesn't allow me to override the onBind method since the service is a final class. Consequently, I can't directly get the service instance via binder to call methods from CacheCleaner Accessibility Service, which extends the default Accessibility Service.

I discovered an alternative approach, using a broadcast receiver. However, there's a problem: if Android stops the CacheCleaner Accessibility Service, which listens for events and handles broadcast events coming from the widget, the service won't be able to receive any events.

The only viable solution seems to be a more complex one: creating an additional bridge service that uses bind to connect the widget and CacheCleaner Accessibility Service. The bridge service can also check whether CacheCleaner Accessibility Service is activated and send a request to the Settings to activate it if needed.

As of now, I haven't solved the second problem yet, which involves creating a widget for custom user lists.

P.S. This issue is taking more time than I expected. I would be extremely grateful if somebody could assist me with the second problem. However, for now, I will pause the investigation on that issue because I'm currently working on several other projects and won't have time to address it in the near future. Thanks for your understanding 😅

P.S.2 I pushed my wip branch for this issue -> https://github.com/bmx666/android-appcachecleaner/tree/issue-30

bmx666 avatar Jul 29 '23 20:07 bmx666

Since Google add more restriction to Accessibility Service, especially for 3rd party app with extra restriction...this feature could not be implemented.

bmx666 avatar Aug 02 '24 22:08 bmx666