Fix launcher crash related to widget updates
LauncherAppWidgetHost fails to cleanup deferred widget when launcher
started binding the widgets in workspace, which leads to a crash because
widgets that was previously attached to the workspace get re-attached to
the workspace.
Bug: 245016152
Test: manual
Change-Id: I4de261e08cfdcee74f210c39bcadf403b98887ab
diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetHost.java b/src/com/android/launcher3/widget/LauncherAppWidgetHost.java
index 5ce8fcf..3e80699 100644
--- a/src/com/android/launcher3/widget/LauncherAppWidgetHost.java
+++ b/src/com/android/launcher3/widget/LauncherAppWidgetHost.java
@@ -323,6 +323,7 @@
if (FeatureFlags.ENABLE_CACHED_WIDGET.get()) {
// First, we clear any previously cached content from existing widgets
mCachedRemoteViews.clear();
+ mDeferredViews.clear();
// Then we proceed to cache the content from the widgets
for (int i = 0; i < mViews.size(); i++) {
final int appWidgetId = mViews.keyAt(i);