int findSyncPosition(){
  int count=mItemCount;
  if (count == 0) {
    return INVALID_POSITION;
  }
  long idToMatch=mSyncRowId;
  int seed=mSyncPosition;
  if (idToMatch == INVALID_ROW_ID) {
    return INVALID_POSITION;
  }
  seed=Math.max(0,seed);
  seed=Math.min(count - 1,seed);
  long endTime=SystemClock.uptimeMillis() + SYNC_MAX_DURATION_MILLIS;
  long rowId;
  int first=seed;
  int last=seed;
  boolean next=false;
  boolean hitFirst;
  boolean hitLast;
  T adapter=getAdapter();
  if (adapter == null) {
    return INVALID_POSITION;
  }
  while (SystemClock.uptimeMillis() <= endTime) {
    rowId=adapter.getItemId(seed);
    if (rowId == idToMatch) {
      return seed;
    }
    hitLast=last == count - 1;
    hitFirst=first == 0;
    if (hitLast && hitFirst) {
      break;
    }
    if (hitFirst || (next && !hitLast)) {
      last++;
      seed=last;
      next=false;
    }
 else     if (hitLast || (!next && !hitFirst)) {
      first--;
      seed=first;
      next=true;
    }
  }
  return INVALID_POSITION;
}

int findSyncPosition ( ) { int count = mItemCount ; if ( count == 0 ) { return INVALID_POSITION ; } long idToMatch = mSyncRowId ; int seed = mSyncPosition ; if ( idToMatch == INVALID_ROW_ID ) { return INVALID_POSITION ; } seed = Math . max ( 0 , seed ) ; seed = Math . min ( count - 1 , seed ) ; long endTime = SystemClock . uptimeMillis ( ) + SYNC_MAX_DURATION_MILLIS ; long rowId ; int first = seed ; int last = seed ; boolean next = false ; boolean hitFirst ; boolean hitLast ; T adapter = getAdapter ( ) ; if ( adapter == null ) { return INVALID_POSITION ; } while ( SystemClock . uptimeMillis ( ) <= endTime ) { rowId = adapter . getItemId ( seed ) ; if ( rowId == idToMatch ) { return seed ; } hitLast = last == count - 1 ; hitFirst = first == 0 ; if ( hitLast && hitFirst ) { break ; } if ( hitFirst || ( next && ! hitLast ) ) { last ++ ; seed = last ; next = false ; } else if ( hitLast || ( ! next && ! hitFirst ) ) { first -- ; seed = first ; next = true ; } } return INVALID_POSITION ; }
searches the adapter for a position matching msyncrowid . the search starts at msyncposition and then alternates between moving up and moving down until 1 ) we find the right position , or 2 ) we run out of time , or 3 ) we have looked at every position
