This fixes a bug in the current code that causes apps to be removed
from the list when they become unavailable.
Change-Id: Ic0b4c0fa34662ce3c458117b6807742448ec6575
Also fix a problem in type-to-filter. It was looking for substring match
instead of searching on word boundaries. It will now search by word
boundaries (separated by space).
displays empty list message when list goes empty. Ideally the list is
not empty for running processes and All filter options. so the
message is just set to third party apps
Remove the empty list view logic from code base
When ManageApps gets started, the list of installed apps is retrieved from PackageManager and
compared against the old list to figure out newly installed apps(since the app has been stopped) and
also to weedout stale entries of packages which might have been deleted.
Since the application objects themselves might have changed the list is usually refreshed with new objects.
Deleted applications are taken care of right away by just removing from the List adapter.
For newly added apps however, the size and label/resource info has to be loaded before being inserted in to
the list since the list is already sorted. So just remove these entries from the list for now and let
ADD_PKG message handle adding the new elements.
Make AppInfo a nested class so that it doesn't hold a reference to its enclosing class and
we have too many such entries one for each package.
Make ListAdapter implement Filterable. Add new implementation for Filter
to search based on prefixes.
When creating the list include the filter option to create actual list entries.
Since Filter.performFiltering is done on a work thread, introduce a new lock
and a HashMap of packages matching a prefix which is then used to create a filtered list of applications.
Also separte out modifying mAppLocalList which is the basis for list and
the dependent mFilterMap used by Filter.performFiltering method to Locked
methods for clarity. Note that mAppLocalList is manipulated on main UI thread everywhere but mFilterMap is not.
Merge commit 'd2136f7e5da6d36a685f5bed2727f0abdafb70bf' into eclair
* commit 'd2136f7e5da6d36a685f5bed2727f0abdafb70bf':
Create a shared preference setting and use it before loading/unloading cache
Merge commit '79748b42e3e891c0d1541753c133fa83638146ce'
* commit '79748b42e3e891c0d1541753c133fa83638146ce':
Fix duplicate entries being added when application is in active use
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.