Program: 92531
Project: 92531
Buggy source:
private void onScrollChanged(){
  if (mCallbacks != null || mCallbackCollection != null) {
    if (getChildCount() > 0) {
      int firstVisiblePosition=getFirstVisiblePosition();
      for (int i=getFirstVisiblePosition(), j=0; i <= getLastVisiblePosition(); i++, j++) {
        if (mChildrenHeights.indexOfKey(i) < 0 || getChildAt(j).getHeight() != mChildrenHeights.get(i)) {
          mChildrenHeights.put(i,getChildAt(j).getHeight());
        }
      }
      View firstVisibleChild=getChildAt(0);
      if (firstVisibleChild != null) {
        if (mPrevFirstVisiblePosition < firstVisiblePosition) {
          int skippedChildrenHeight=0;
          if (firstVisiblePosition - mPrevFirstVisiblePosition != 1) {
            for (int i=firstVisiblePosition - 1; i > mPrevFirstVisiblePosition; i--) {
              if (0 < mChildrenHeights.indexOfKey(i)) {
                skippedChildrenHeight+=mChildrenHeights.get(i);
              }
 else {
                skippedChildrenHeight+=firstVisibleChild.getHeight();
              }
            }
          }
          mPrevScrolledChildrenHeight+=mPrevFirstVisibleChildHeight + skippedChildrenHeight;
          mPrevFirstVisibleChildHeight=firstVisibleChild.getHeight();
        }
 else         if (firstVisiblePosition < mPrevFirstVisiblePosition) {
          int skippedChildrenHeight=0;
          if (mPrevFirstVisiblePosition - firstVisiblePosition != 1) {
            for (int i=mPrevFirstVisiblePosition - 1; i > firstVisiblePosition; i--) {
              if (0 < mChildrenHeights.indexOfKey(i)) {
                skippedChildrenHeight+=mChildrenHeights.get(i);
              }
 else {
                skippedChildrenHeight+=firstVisibleChild.getHeight();
              }
            }
          }
          mPrevScrolledChildrenHeight-=firstVisibleChild.getHeight() + skippedChildrenHeight;
          mPrevFirstVisibleChildHeight=firstVisibleChild.getHeight();
        }
 else         if (firstVisiblePosition == 0) {
          mPrevFirstVisibleChildHeight=firstVisibleChild.getHeight();
          mPrevScrolledChildrenHeight=0;
        }
        if (mPrevFirstVisibleChildHeight < 0) {
          mPrevFirstVisibleChildHeight=0;
        }
        mScrollY=mPrevScrolledChildrenHeight - firstVisibleChild.getTop();
        mPrevFirstVisiblePosition=firstVisiblePosition;
        dispatchOnScrollChanged(mScrollY,mFirstScroll,mDragging);
        if (mFirstScroll) {
          mFirstScroll=false;
        }
        if (mPrevScrollY < mScrollY) {
          mScrollState=ScrollState.UP;
        }
 else         if (mScrollY < mPrevScrollY) {
          mScrollState=ScrollState.DOWN;
        }
 else {
          mScrollState=ScrollState.STOP;
        }
        mPrevScrollY=mScrollY;
      }
    }
  }
}

Fixed version (ground truth):
private void onScrollChanged(){
  if (mCallbacks != null || mCallbackCollection != null) {
    if (getChildCount() > 0) {
      int firstVisiblePosition=getFirstVisiblePosition();
      for (int i=getFirstVisiblePosition(), j=0; i <= getLastVisiblePosition(); i++, j++) {
        if (mChildrenHeights.indexOfKey(i) < 0 || getChildAt(j).getHeight() != mChildrenHeights.get(i)) {
          mChildrenHeights.put(i,getChildAt(j).getHeight());
        }
      }
      View firstVisibleChild=getChildAt(0);
      if (firstVisibleChild != null) {
        if (mPrevFirstVisiblePosition < firstVisiblePosition) {
          int skippedChildrenHeight=0;
          if (firstVisiblePosition - mPrevFirstVisiblePosition != 1) {
            for (int i=firstVisiblePosition - 1; i > mPrevFirstVisiblePosition; i--) {
              if (0 < mChildrenHeights.indexOfKey(i)) {
                skippedChildrenHeight+=mChildrenHeights.get(i);
              }
 else {
                skippedChildrenHeight+=firstVisibleChild.getHeight();
              }
            }
          }
          mPrevScrolledChildrenHeight+=mPrevFirstVisibleChildHeight + skippedChildrenHeight;
          mPrevFirstVisibleChildHeight=firstVisibleChild.getHeight();
        }
 else         if (firstVisiblePosition < mPrevFirstVisiblePosition) {
          int skippedChildrenHeight=0;
          if (mPrevFirstVisiblePosition - firstVisiblePosition != 1) {
            for (int i=mPrevFirstVisiblePosition - 1; i > firstVisiblePosition; i--) {
              if (0 < mChildrenHeights.indexOfKey(i)) {
                skippedChildrenHeight+=mChildrenHeights.get(i);
              }
 else {
                skippedChildrenHeight+=firstVisibleChild.getHeight();
              }
            }
          }
          mPrevScrolledChildrenHeight-=firstVisibleChild.getHeight() + skippedChildrenHeight;
          mPrevFirstVisibleChildHeight=firstVisibleChild.getHeight();
        }
 else         if (firstVisiblePosition == 0) {
          mPrevFirstVisibleChildHeight=firstVisibleChild.getHeight();
          mPrevScrolledChildrenHeight=0;
        }
        if (mPrevFirstVisibleChildHeight < 0) {
          mPrevFirstVisibleChildHeight=0;
        }
        mScrollY=mPrevScrolledChildrenHeight - firstVisibleChild.getTop() + firstVisiblePosition * getDividerHeight();
        mPrevFirstVisiblePosition=firstVisiblePosition;
        dispatchOnScrollChanged(mScrollY,mFirstScroll,mDragging);
        if (mFirstScroll) {
          mFirstScroll=false;
        }
        if (mPrevScrollY < mScrollY) {
          mScrollState=ScrollState.UP;
        }
 else         if (mScrollY < mPrevScrollY) {
          mScrollState=ScrollState.DOWN;
        }
 else {
          mScrollState=ScrollState.STOP;
        }
        mPrevScrollY=mScrollY;
      }
    }
  }
}