use of com.android.launcher3.util.RaceConditionTracker.ENTER in project android_packages_apps_Launcher3 by AOSPA.
the class Workspace method onDragStart.
@Override
public void onDragStart(DragObject dragObject, DragOptions options) {
if (ENFORCE_DRAG_EVENT_ORDER) {
enforceDragParity("onDragStart", 0, 0);
}
if (mDragInfo != null && mDragInfo.cell != null) {
CellLayout layout = (CellLayout) (mDragInfo.cell instanceof LauncherAppWidgetHostView ? dragObject.dragView.getContentViewParent().getParent() : mDragInfo.cell.getParent().getParent());
layout.markCellsAsUnoccupiedForView(mDragInfo.cell);
}
updateChildrenLayersEnabled();
// Do not add a new page if it is a accessible drag which was not started by the workspace.
// We do not support accessibility drag from other sources and instead provide a direct
// action for move/add to homescreen.
// When a accessible drag is started by the folder, we only allow rearranging withing the
// folder.
boolean addNewPage = !(options.isAccessibleDrag && dragObject.dragSource != this);
if (addNewPage) {
mDeferRemoveExtraEmptyScreen = false;
addExtraEmptyScreenOnDrag(dragObject);
if (dragObject.dragInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET && dragObject.dragSource != this) {
// When dragging a widget from different source, move to a page which has
// enough space to place this widget (after rearranging/resizing). We special case
// widgets as they cannot be placed inside a folder.
// Start at the current page and search right (on LTR) until finding a page with
// enough space. Since an empty screen is the furthest right, a page must be found.
int currentPage = getDestinationPage();
for (int pageIndex = currentPage; pageIndex < getPageCount(); pageIndex++) {
CellLayout page = (CellLayout) getPageAt(pageIndex);
if (page.hasReorderSolution(dragObject.dragInfo)) {
setCurrentPage(pageIndex);
break;
}
}
}
}
// Always enter the spring loaded mode
mLauncher.getStateManager().goToState(SPRING_LOADED);
mStatsLogManager.logger().withItemInfo(dragObject.dragInfo).withInstanceId(dragObject.logInstanceId).log(LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED);
}
Aggregations