TeamAmaze / AmazeFileUtilities

An open source Google Files alternative for Android
https://teamamaze.xyz
GNU General Public License v3.0
316 stars 28 forks source link

Add analysis to show list of growing apps #141

Closed seelchen closed 8 months ago

seelchen commented 9 months ago

Description

This adds an analysis to show by how much each installed app has grown within a configurable amount of time. A background service is used to query the size of each app every day and store it in the database.

Issue tracker

Fixes #139

seelchen commented 8 months ago

This is ready for review! I tried to add tests for the worker, but I couldn't find a way to mock static methods with mockito. I also couldn't use mockk because its target JVM version is different to the one of the project. If you have any other mocking library suggestions, I can try to write test with them, but as far as I can tell from my manual testing, the worker works fine.

seelchen commented 8 months ago

After I deleted the database and reinstalled the debug app to test the new commit, I saw that the analysis showed that all apps grew a lot. I think that is because when the PeriodicWorkRequest is executed for the first time, I did not grant the UsageStats permission yet. Therefore, the findApplicationInfoSizeFallback method is used to get an approximation of the app size. However, when I grant the UsageStats permission, the exact app size can be determined and makes it seem like the apps all grew a lot. I wanted to ask if I should add a check in the PeriodicWorkRequest if the UsageStats permission was granted for versions >= Build.VERSION_CODES.O or if the current behavior is fine?

VishalNehra commented 8 months ago

I was wondering the same why it's showing such huge difference. Yes, you should the change to add a check. Only add entries when we have permissions

seelchen commented 8 months ago

I was wondering the same why it's showing such huge difference. Yes, you should the change to add a check. Only add entries when we have permissions

Fixed in the latest two commits. To see the change, you need to delete all old values of in the database.

VishalNehra commented 8 months ago

Amazing work! Looks good :)