diff options
author | Winson Chung <winsonc@google.com> | 2012-03-29 17:37:41 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2012-03-30 11:01:01 -0700 |
commit | c208ff9c5ded4953ded6a3358097c9f7280df825 (patch) | |
tree | ae52c873db4c4159083c307d4006cf81fd9319af /src/com/android/launcher2/LauncherModel.java | |
parent | 4b57851287a8806cad6f836e24c5b835a48c22a9 (diff) | |
download | android_packages_apps_Trebuchet-c208ff9c5ded4953ded6a3358097c9f7280df825.tar.gz android_packages_apps_Trebuchet-c208ff9c5ded4953ded6a3358097c9f7280df825.tar.bz2 android_packages_apps_Trebuchet-c208ff9c5ded4953ded6a3358097c9f7280df825.zip |
Adding workaround for issue where icon labels on workspace were loaded differently than those in AllApps. (Bug 5250760)
Change-Id: I9b6fc848befa1bcda84e97ccc9787faf5bda7a5f
Diffstat (limited to 'src/com/android/launcher2/LauncherModel.java')
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 30eb86c5a..32c77c7c1 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -1354,6 +1354,7 @@ public class LauncherModel extends BroadcastReceiver { } // shallow copy + @SuppressWarnings("unchecked") final ArrayList<ApplicationInfo> list = (ArrayList<ApplicationInfo>) mAllAppsList.data.clone(); mHandler.post(new Runnable() { @@ -1657,7 +1658,26 @@ public class LauncherModel extends BroadcastReceiver { // but don't worry about that. All we're doing with usingFallbackIcon is // to avoid saving lots of copies of that in the database, and most apps // have icons anyway. - final ResolveInfo resolveInfo = manager.resolveActivity(intent, 0); + + // Attempt to use queryIntentActivities to get the ResolveInfo (with IntentFilter info) and + // if that fails, or is ambiguious, fallback to the standard way of getting the resolve info + // via resolveActivity(). + ResolveInfo resolveInfo = null; + ComponentName oldComponent = intent.getComponent(); + Intent newIntent = new Intent(intent.getAction(), null); + newIntent.addCategory(Intent.CATEGORY_LAUNCHER); + newIntent.setPackage(oldComponent.getPackageName()); + List<ResolveInfo> infos = manager.queryIntentActivities(newIntent, 0); + for (ResolveInfo i : infos) { + ComponentName cn = new ComponentName(i.activityInfo.packageName, + i.activityInfo.name); + if (cn.equals(oldComponent)) { + resolveInfo = i; + } + } + if (resolveInfo == null) { + resolveInfo = manager.resolveActivity(intent, 0); + } if (resolveInfo != null) { icon = mIconCache.getIcon(componentName, resolveInfo, labelCache); } |