diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-07-24 16:48:01 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-07-24 16:48:01 -0700 |
commit | 2d86dfec5797bfd4fba78562032c14bd9b6cfa7a (patch) | |
tree | 536926534512237126f3ac6f2a27ea6e851c0fcc | |
parent | 004f9d772ce44a95111e38e9a447074b090b37f9 (diff) | |
download | packages_apps_trebuchet-2d86dfec5797bfd4fba78562032c14bd9b6cfa7a.zip packages_apps_trebuchet-2d86dfec5797bfd4fba78562032c14bd9b6cfa7a.tar.gz packages_apps_trebuchet-2d86dfec5797bfd4fba78562032c14bd9b6cfa7a.tar.bz2 |
Fix launcher updating when all of an app's activities disappear.
Also uses a more efficient way to get all activities for a package.
Change-Id: Ic360082f0a728cf1b388af18b22122bfce866149
-rw-r--r-- | src/com/android/launcher2/AllAppsList.java | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/com/android/launcher2/AllAppsList.java b/src/com/android/launcher2/AllAppsList.java index 41aa6ca..3a5baea 100644 --- a/src/com/android/launcher2/AllAppsList.java +++ b/src/com/android/launcher2/AllAppsList.java @@ -150,6 +150,17 @@ class AllAppsList { modified.add(applicationInfo); } } + } else { + // Remove all data for this package. + for (int i = data.size() - 1; i >= 0; i--) { + final ApplicationInfo applicationInfo = data.get(i); + final ComponentName component = applicationInfo.intent.getComponent(); + if (packageName.equals(component.getPackageName())) { + removed.add(applicationInfo); + mIconCache.remove(component); + data.remove(i); + } + } } } @@ -161,23 +172,10 @@ class AllAppsList { final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); + mainIntent.setPackage(packageName); final List<ResolveInfo> apps = packageManager.queryIntentActivities(mainIntent, 0); - final List<ResolveInfo> matches = new ArrayList<ResolveInfo>(); - - if (apps != null) { - // Find all activities that match the packageName - int count = apps.size(); - for (int i = 0; i < count; i++) { - final ResolveInfo info = apps.get(i); - final ActivityInfo activityInfo = info.activityInfo; - if (packageName.equals(activityInfo.packageName)) { - matches.add(info); - } - } - } - - return matches; + return apps != null ? apps : new ArrayList<ResolveInfo>(); } /** |