Skip to content

Conversation

@seelchen
Copy link
Contributor

@seelchen seelchen commented Dec 9, 2023

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 seelchen force-pushed the feature/app-size-diff branch from 4ce6982 to da9232d Compare December 17, 2023 18:51
@seelchen seelchen marked this pull request as ready for review December 20, 2023 18:13
@seelchen
Copy link
Contributor Author

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 seelchen requested a review from VishalNehra December 22, 2023 16:25
@seelchen
Copy link
Contributor Author

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
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

Amazing work! Looks good :)

@VishalNehra VishalNehra merged commit f931843 into TeamAmaze:main Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analysis to show list of apps that are growing in size

2 participants