Restore mDragInfo when deferring onDropComplete() for uninstall.
We moved mDragInfo = null to onDragEnd() since onDropComplete()
isn't called for pre-drags, but this led to NPE when returning
from unistall or app info since onDropComplete() is called after
onDragEnd() in this case. So now we restore a copy of mDragInfo.
Bug: 32415014
Change-Id: I7ef4fb7145c3c78039af1131e77538969db58141
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index ae34638..f7147e4 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -3656,8 +3656,10 @@
public void onDropCompleted(final View target, final DragObject d,
final boolean isFlingToDelete, final boolean success) {
if (mDeferDropAfterUninstall) {
+ final CellLayout.CellInfo dragInfo = mDragInfo;
mDeferredAction = new Runnable() {
public void run() {
+ mDragInfo = dragInfo; // Restore the drag info that was cleared in onDragEnd()
onDropCompleted(target, d, isFlingToDelete, success);
mDeferredAction = null;
}
@@ -3685,6 +3687,7 @@
&& mDragInfo.cell != null) {
mDragInfo.cell.setVisibility(VISIBLE);
}
+ mDragInfo = null;
if (!isFlingToDelete) {
// Fling to delete already exits spring loaded mode after the animation finishes.