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
This commit is contained in:
Tony Wickham
2016-10-26 12:51:14 -07:00
parent 5fd72d865e
commit 4feb27e6b1

View File

@@ -3656,8 +3656,10 @@ public class Workspace extends PagedView
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 @@ public class Workspace extends PagedView
&& mDragInfo.cell != null) {
mDragInfo.cell.setVisibility(VISIBLE);
}
mDragInfo = null;
if (!isFlingToDelete) {
// Fling to delete already exits spring loaded mode after the animation finishes.