Fixes #1940691. Sync packages when home receives a reinstall notification.

Home was only updating known activities. This change makes home also check for
removed activities and added activities.
This commit is contained in:
Romain Guy 2009-06-24 13:45:46 -07:00
parent 1ce1a24cba
commit b132a97cb7
1 changed files with 24 additions and 15 deletions

View File

@ -244,6 +244,8 @@ public class LauncherModel {
} }
} }
if (syncLocked(launcher, packageName)) changed = true;
if (changed) { if (changed) {
adapter.sort(new ApplicationInfoComparator()); adapter.sort(new ApplicationInfoComparator());
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
@ -268,6 +270,15 @@ public class LauncherModel {
} }
if (packageName != null && packageName.length() > 0) { if (packageName != null && packageName.length() > 0) {
if (syncLocked(launcher, packageName)) {
final ApplicationsAdapter adapter = mApplicationsAdapter;
adapter.sort(new ApplicationInfoComparator());
adapter.notifyDataSetChanged();
}
}
}
private boolean syncLocked(Launcher launcher, String packageName) {
final PackageManager packageManager = launcher.getPackageManager(); final PackageManager packageManager = launcher.getPackageManager();
final List<ResolveInfo> matches = findActivitiesForPackage(packageManager, packageName); final List<ResolveInfo> matches = findActivitiesForPackage(packageManager, packageName);
@ -280,12 +291,10 @@ public class LauncherModel {
// Also updates existing activities with new labels/icons // Also updates existing activities with new labels/icons
boolean added = addEnabledAndUpdateActivities(matches, adapter, launcher); boolean added = addEnabledAndUpdateActivities(matches, adapter, launcher);
if (added || removed) { return added || removed;
adapter.sort(new ApplicationInfoComparator());
adapter.notifyDataSetChanged();
}
}
} }
return false;
} }
private static List<ResolveInfo> findActivitiesForPackage(PackageManager packageManager, private static List<ResolveInfo> findActivitiesForPackage(PackageManager packageManager,