Program: 22716
Project: 22716
Buggy source:
boolean scrollToRectOrFocus(Rect rectangle,boolean immediate){
  final View.AttachInfo attachInfo=mAttachInfo;
  final Rect ci=attachInfo.mContentInsets;
  final Rect vi=attachInfo.mVisibleInsets;
  int scrollY=0;
  boolean handled=false;
  if (vi.left > ci.left || vi.top > ci.top || vi.right > ci.right || vi.bottom > ci.bottom) {
    scrollY=mScrollY;
    View focus=mRealFocusedView;
    if (focus == null || focus.mAttachInfo != mAttachInfo) {
      mRealFocusedView=null;
      return false;
    }
    if (focus != mLastScrolledFocus) {
      rectangle=null;
    }
    if (DEBUG_INPUT_RESIZE)     Log.v(TAG,"String_Node_Str" + focus + "String_Node_Str"+ rectangle+ "String_Node_Str"+ ci+ "String_Node_Str"+ vi);
    if (focus == mLastScrolledFocus && !mScrollMayChange && rectangle == null) {
      if (DEBUG_INPUT_RESIZE)       Log.v(TAG,"String_Node_Str" + mScrollY + "String_Node_Str"+ vi.toShortString());
    }
 else     if (focus != null) {
      mLastScrolledFocus=focus;
      mScrollMayChange=false;
      if (DEBUG_INPUT_RESIZE)       Log.v(TAG,"String_Node_Str");
      if (focus.getGlobalVisibleRect(mVisRect,null)) {
        if (DEBUG_INPUT_RESIZE)         Log.v(TAG,"String_Node_Str" + mView.getWidth() + "String_Node_Str"+ mView.getHeight()+ "String_Node_Str"+ ci.toShortString()+ "String_Node_Str"+ vi.toShortString());
        if (rectangle == null) {
          focus.getFocusedRect(mTempRect);
          if (DEBUG_INPUT_RESIZE)           Log.v(TAG,"String_Node_Str" + focus + "String_Node_Str"+ mTempRect.toShortString());
          ((ViewGroup)mView).offsetDescendantRectToMyCoords(focus,mTempRect);
          if (DEBUG_INPUT_RESIZE)           Log.v(TAG,"String_Node_Str" + mTempRect.toShortString() + "String_Node_Str"+ mVisRect.toShortString());
        }
 else {
          mTempRect.set(rectangle);
          if (DEBUG_INPUT_RESIZE)           Log.v(TAG,"String_Node_Str" + mTempRect.toShortString() + "String_Node_Str"+ mVisRect.toShortString());
        }
        if (mTempRect.intersect(mVisRect)) {
          if (DEBUG_INPUT_RESIZE)           Log.v(TAG,"String_Node_Str" + mTempRect.toShortString());
          if (mTempRect.height() > (mView.getHeight() - vi.top - vi.bottom)) {
            if (DEBUG_INPUT_RESIZE)             Log.v(TAG,"String_Node_Str" + scrollY);
          }
 else           if ((mTempRect.top - scrollY) < vi.top) {
            scrollY-=vi.top - (mTempRect.top - scrollY);
            if (DEBUG_INPUT_RESIZE)             Log.v(TAG,"String_Node_Str" + scrollY);
          }
 else           if ((mTempRect.bottom - scrollY) > (mView.getHeight() - vi.bottom)) {
            scrollY+=(mTempRect.bottom - scrollY) - (mView.getHeight() - vi.bottom);
            if (DEBUG_INPUT_RESIZE)             Log.v(TAG,"String_Node_Str" + scrollY);
          }
          handled=true;
        }
      }
    }
  }
  if (scrollY != mScrollY) {
    if (DEBUG_INPUT_RESIZE)     Log.v(TAG,"String_Node_Str" + mScrollY + "String_Node_Str"+ scrollY);
    if (!immediate) {
      if (mScroller == null) {
        mScroller=new Scroller(mView.getContext());
      }
      mScroller.startScroll(0,mScrollY,0,scrollY - mScrollY);
    }
 else     if (mScroller != null) {
      mScroller.abortAnimation();
    }
    mScrollY=scrollY;
  }
  return handled;
}

Fixed version (ground truth):
boolean scrollToRectOrFocus(Rect rectangle,boolean immediate){
  final View.AttachInfo attachInfo=mAttachInfo;
  final Rect ci=attachInfo.mContentInsets;
  final Rect vi=attachInfo.mVisibleInsets;
  int scrollY=0;
  boolean handled=false;
  if (vi.left > ci.left || vi.top > ci.top || vi.right > ci.right || vi.bottom > ci.bottom) {
    scrollY=mScrollY;
    View focus=mRealFocusedView;
    if (focus == null || focus.mAttachInfo != mAttachInfo) {
      mRealFocusedView=null;
      return false;
    }
    if (focus != mLastScrolledFocus) {
      rectangle=null;
    }
    if (DEBUG_INPUT_RESIZE)     Log.v(TAG,"String_Node_Str" + focus + "String_Node_Str"+ rectangle+ "String_Node_Str"+ ci+ "String_Node_Str"+ vi);
    if (focus == mLastScrolledFocus && !mScrollMayChange && rectangle == null) {
      if (DEBUG_INPUT_RESIZE)       Log.v(TAG,"String_Node_Str" + mScrollY + "String_Node_Str"+ vi.toShortString());
    }
 else     if (focus != null) {
      mLastScrolledFocus=focus;
      mScrollMayChange=false;
      if (DEBUG_INPUT_RESIZE)       Log.v(TAG,"String_Node_Str");
      if (focus.getGlobalVisibleRect(mVisRect,null)) {
        if (DEBUG_INPUT_RESIZE)         Log.v(TAG,"String_Node_Str" + mView.getWidth() + "String_Node_Str"+ mView.getHeight()+ "String_Node_Str"+ ci.toShortString()+ "String_Node_Str"+ vi.toShortString());
        if (rectangle == null) {
          focus.getFocusedRect(mTempRect);
          if (DEBUG_INPUT_RESIZE)           Log.v(TAG,"String_Node_Str" + focus + "String_Node_Str"+ mTempRect.toShortString());
          if (mView instanceof ViewGroup) {
            ((ViewGroup)mView).offsetDescendantRectToMyCoords(focus,mTempRect);
          }
          if (DEBUG_INPUT_RESIZE)           Log.v(TAG,"String_Node_Str" + mTempRect.toShortString() + "String_Node_Str"+ mVisRect.toShortString());
        }
 else {
          mTempRect.set(rectangle);
          if (DEBUG_INPUT_RESIZE)           Log.v(TAG,"String_Node_Str" + mTempRect.toShortString() + "String_Node_Str"+ mVisRect.toShortString());
        }
        if (mTempRect.intersect(mVisRect)) {
          if (DEBUG_INPUT_RESIZE)           Log.v(TAG,"String_Node_Str" + mTempRect.toShortString());
          if (mTempRect.height() > (mView.getHeight() - vi.top - vi.bottom)) {
            if (DEBUG_INPUT_RESIZE)             Log.v(TAG,"String_Node_Str" + scrollY);
          }
 else           if ((mTempRect.top - scrollY) < vi.top) {
            scrollY-=vi.top - (mTempRect.top - scrollY);
            if (DEBUG_INPUT_RESIZE)             Log.v(TAG,"String_Node_Str" + scrollY);
          }
 else           if ((mTempRect.bottom - scrollY) > (mView.getHeight() - vi.bottom)) {
            scrollY+=(mTempRect.bottom - scrollY) - (mView.getHeight() - vi.bottom);
            if (DEBUG_INPUT_RESIZE)             Log.v(TAG,"String_Node_Str" + scrollY);
          }
          handled=true;
        }
      }
    }
  }
  if (scrollY != mScrollY) {
    if (DEBUG_INPUT_RESIZE)     Log.v(TAG,"String_Node_Str" + mScrollY + "String_Node_Str"+ scrollY);
    if (!immediate) {
      if (mScroller == null) {
        mScroller=new Scroller(mView.getContext());
      }
      mScroller.startScroll(0,mScrollY,0,scrollY - mScrollY);
    }
 else     if (mScroller != null) {
      mScroller.abortAnimation();
    }
    mScrollY=scrollY;
  }
  return handled;
}