Fix cast exception when dropping widgets to a drop target
When inflating a widget directly in the DragView, I've overridden
the layout param to FrameLayout.LayoutParam. Before drag complete,
we should restore the previous layout param.
Test: Drag a widget to a drop target. No crash is observed.
Bug: 186111130
Change-Id: Ifd33d57a886496ab31d4e741870b0ae18ca9ce4e
diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java
index 7926862..a26217c 100644
--- a/src/com/android/launcher3/ButtonDropTarget.java
+++ b/src/com/android/launcher3/ButtonDropTarget.java
@@ -240,6 +240,7 @@
final Rect to = getIconRect(d);
final float scale = (float) to.width() / from.width();
+ d.dragView.detachContentView(/* reattachToPreviousParent= */ true);
mDropTargetBar.deferOnDragEnd();
Runnable onAnimationEndRunnable = () -> {