Merge "Fixing crash upon cancellation of an accessible drag." into ub-launcher3-master
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index a34711c..d3c7a1d 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -878,6 +878,9 @@
             }
         }
 
+        LauncherAccessibilityDelegate delegate =
+                LauncherAppState.getInstance().getAccessibilityDelegate();
+
         // We enforce at least one page to add new items to. In the case that we remove the last
         // such screen, we convert the last screen to the empty screen
         int minScreens = 1 + numCustomPages();
@@ -892,6 +895,11 @@
                 if (indexOfChild(cl) < currentPage) {
                     pageShift++;
                 }
+
+                if (delegate != null && delegate.isInAccessibleDrag()) {
+                    cl.enableAccessibleDrag(false, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG);
+                }
+
                 removeView(cl);
             } else {
                 // if this is the last non-custom content screen, convert it to the empty screen