Fix null pointer exception in WidgetsModel
Due to not clearing the PackageItemInfos list when uninstall happened,
uninstalled PackageItemInfo lingered around when there wasn't associated
Widgets to it. Hence causing null pointer exception.
b/20216900
Change-Id: I5601cf618079044d24ffc3ee835c1468fa2e9371
diff --git a/src/com/android/launcher3/widget/WidgetsModel.java b/src/com/android/launcher3/widget/WidgetsModel.java
index 1447bef..71a7b94 100644
--- a/src/com/android/launcher3/widget/WidgetsModel.java
+++ b/src/com/android/launcher3/widget/WidgetsModel.java
@@ -71,8 +71,10 @@
// Temporary list for {@link PackageItemInfos} to avoid having to go through
// {@link mPackageItemInfos} to locate the key to be used for {@link #mWidgetsList}
HashMap<String, PackageItemInfo> tmpPackageItemInfos = new HashMap<>();
+
// clear the lists.
mWidgetsList.clear();
+ mPackageItemInfos.clear();
// add and update.
for (Object o: widgetsShortcuts) {