Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit b285593c authored by Suchi Amalapurapu's avatar Suchi Amalapurapu
Browse files

Reorganize message posting when updating sizes and resources. Rather than posting

a message for each package, post a message for  a set of packages(8) so that we don't
end up posting too many messages and making the UI non-responsive by keeping
the Handler too busy. We just pass the loaded info as a map in the message object.
Changes to back ground threads that compute sizes and load resources.

Add a new AppInfoCache class with some additional methods to load and persist cache.
As of now this just uses a raw file to cache application sizes and labels. We
could have gotten away with a simple map object but for clarity and future enhancements
just reorganized everything into a class. Load the cache in onCreate and persist
in onDestroy rather than start and stop. Using the cache we get < 1sec load times.
Peristing the cache has negligible performance effects. Remove multiple references to
cache and just use one object all over the code.

Rework AppInfo class and remove some confusing initializations. Also move the formatting
sizes part to back ground threads rather than in the constructor of AppInfo projects.
Formatting the sizes takes a lot of time and there is no point in blocking the UI thread
with this operation.

Changes to Adapter to use the newly created cache system. Define new comparator
for comparing application labels when sorting lists rather than using the one defined in
ApplicationInfo class which was loading the labels again in compare method. This was redundant
and since we cache these labels anyway, just use the cached labels instead. Rename and add
new methods for some of the new handler messages that send updates to a list of objects now.
Changes to removeFromList method and just remove entry from lists and cache linearly.

Also fix a bug in the adapter class where we reinit the list everytime the activity gets
restarted. Add a check here to invoke notifyDataSetChanged if underlying data changes.

Add some debug statements to record time.
parent 599221c7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment