Merge "Fix preview layout crash upon screen rotation" into sc-dev am: 0062822976 am: 8354f61df5

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14881297

Change-Id: I6b32b7fd75459f4c3fa4de9178f1bf8eab338c49
This commit is contained in:
Steven Ng
2021-06-07 21:04:55 +00:00
committed by Automerger Merge Worker
@@ -492,6 +492,10 @@ public class LauncherAppWidgetHostView extends NavigableAppWidgetHostView
return;
}
LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) getTag();
if (info == null) {
// This occurs when LauncherAppWidgetHostView is used to render a preview layout.
return;
}
// Remove and rebind the current widget (which was inflated in the wrong
// orientation), but don't delete it from the database
mLauncher.removeItem(this, info, false /* deleteFromDb */);