@Override
    public int startDragPosition(MotionEvent ev) {
      ListAdapter adapter = dragSortListView.getAdapter();
      // We lock the dragging when the number of account is 0 or 1.
      if (adapter == null || adapter.getCount() <= 1) {
        return DragSortController.MISS;
      }

      // We only allow dragging on selected item.
      int position = super.startDragPosition(ev);
      boolean allowDragging = false;

      try {
        if (getMultiSelectListSingleCheckedItemPosition(dragSortListView) == position) {
          allowDragging = true;
        }
      } catch (IllegalStateException ignored) {
        // No pin code is selected.
      }

      if (!allowDragging) {
        position = DragSortController.MISS;
      }

      if (position != DragSortController.MISS && startDraggingListener != null) {
        startDraggingListener.startDragging();
      }
      return position;
    }
Event when user start dragging the item.
java/com/google/android/apps/authenticator/AuthenticatorActivity.java