Fixing crash upon cancellation of an accessible drag.

This fixes perhaps an old bug.

If we started an accessible drag for an only item on a page,
then uninstalled the app while dragging, the page was removed
without unsetting its accessibility delegate. Later, the system asks
the delegate to do something, but the drag is over, and some pointers
are null, so everything crashes.

Fixing this.

Bug: 22028725
Change-Id: I85adcd42ae896603634994e20a7790792f7e84b1
This commit is contained in:
Vadim Tryshev 2015-08-11 16:21:04 -07:00
parent 784d3a4a92
commit de1e67c388
1 changed files with 8 additions and 0 deletions

View File

@ -878,6 +878,9 @@ public class Workspace extends PagedView
}
}
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 @@ public class Workspace extends PagedView
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