diff options
author | Michael Jurka <mikejurka@google.com> | 2011-11-10 17:02:56 -0800 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-11-10 17:16:19 -0800 |
commit | dbc1f657863dd9c57a2d30381d3fb36bc7076456 (patch) | |
tree | 075edcf62dceaa50f3b5faa942bfbafed3b292da /src | |
parent | 4decf123e460a22d878dff1ba193751932efaa0f (diff) | |
download | android_packages_apps_Trebuchet-dbc1f657863dd9c57a2d30381d3fb36bc7076456.tar.gz android_packages_apps_Trebuchet-dbc1f657863dd9c57a2d30381d3fb36bc7076456.tar.bz2 android_packages_apps_Trebuchet-dbc1f657863dd9c57a2d30381d3fb36bc7076456.zip |
Fix NPE that occurs with poorly behaved widgets
Bug #5587311
Change-Id: Ida55463575ae94bc469bd2caae4c8b99e54d5a6b
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 6667f7cc1..22f2692ca 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -460,7 +460,14 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen AppWidgetManager.getInstance(mLauncher).getInstalledProviders(); Intent shortcutsIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT); List<ResolveInfo> shortcuts = mPackageManager.queryIntentActivities(shortcutsIntent, 0); - mWidgets.addAll(widgets); + for (AppWidgetProviderInfo widget : widgets) { + if (widget.minWidth > 0 && widget.minHeight > 0) { + mWidgets.add(widget); + } else { + Log.e(LOG_TAG, "Widget " + widget.provider + " has invalid dimensions (" + + widget.minWidth + ", " + widget.minHeight + ")"); + } + } mWidgets.addAll(shortcuts); Collections.sort(mWidgets, new LauncherModel.WidgetAndShortcutNameComparator(mPackageManager)); |