nus-yam/ex-repair huggingface dataset:
Program: 2649
Project: 2649
Buggy source:
/** 
 * Sets the size of the padding between the compound drawables and the text.
 * @attr ref android.R.styleable#TextView_drawablePadding
 */
@android.view.RemotableViewMethod public void setCompoundDrawablePadding(int pad){
  Drawables dr=mDrawables;
  if (pad == 0) {
    if (dr != null) {
      dr.mDrawablePadding=pad;
    }
  }
 else {
    if (dr == null) {
      mDrawables=dr=new Drawables();
    }
    dr.mDrawablePadding=pad;
  }
  invalidate();
  requestLayout();
}

Fixed version (ground truth):
/** 
 * Sets the size of the padding between the compound drawables and the text.
 * @attr ref android.R.styleable#TextView_drawablePadding
 */
@android.view.RemotableViewMethod public void setCompoundDrawablePadding(int pad){
  Drawables dr=mDrawables;
  if (pad == 0) {
    if (dr != null) {
      dr.mDrawablePadding=pad;
    }
  }
 else {
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    dr.mDrawablePadding=pad;
  }
  invalidate();
  requestLayout();
}
Program: 2651
Project: 2651
Buggy source:
/** 
 * Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.  Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
 * @attr ref android.R.styleable#TextView_drawableStart
 * @attr ref android.R.styleable#TextView_drawableTop
 * @attr ref android.R.styleable#TextView_drawableEnd
 * @attr ref android.R.styleable#TextView_drawableBottom
 */
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start,Drawable top,Drawable end,Drawable bottom){
  resetResolvedDrawables();
  if (start != null) {
    start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
  }
  if (end != null) {
    end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
  }
  if (top != null) {
    top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());
  }
  if (bottom != null) {
    bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());
  }
  setCompoundDrawablesRelative(start,top,end,bottom);
}

Fixed version (ground truth):
/** 
 * Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.  Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
 * @attr ref android.R.styleable#TextView_drawableStart
 * @attr ref android.R.styleable#TextView_drawableTop
 * @attr ref android.R.styleable#TextView_drawableEnd
 * @attr ref android.R.styleable#TextView_drawableBottom
 */
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start,Drawable top,Drawable end,Drawable bottom){
  if (start != null) {
    start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
  }
  if (end != null) {
    end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
  }
  if (top != null) {
    top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());
  }
  if (bottom != null) {
    bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());
  }
  setCompoundDrawablesRelative(start,top,end,bottom);
}
Program: 2652
Project: 2652
Buggy source:
public void resolveWithLayoutDirection(int layoutDirection){
switch (layoutDirection) {
case LAYOUT_DIRECTION_RTL:
    if (mDrawableStart != null) {
      mDrawableRight=mDrawableStart;
      mDrawableSizeRight=mDrawableSizeStart;
      mDrawableHeightRight=mDrawableHeightStart;
    }
  if (mDrawableEnd != null) {
    mDrawableLeft=mDrawableEnd;
    mDrawableSizeLeft=mDrawableSizeEnd;
    mDrawableHeightLeft=mDrawableHeightEnd;
  }
break;
case LAYOUT_DIRECTION_LTR:
default :
if (mDrawableStart != null) {
mDrawableLeft=mDrawableStart;
mDrawableSizeLeft=mDrawableSizeStart;
mDrawableHeightLeft=mDrawableHeightStart;
}
if (mDrawableEnd != null) {
mDrawableRight=mDrawableEnd;
mDrawableSizeRight=mDrawableSizeEnd;
mDrawableHeightRight=mDrawableHeightEnd;
}
break;
}
applyErrorDrawableIfNeeded(layoutDirection);
updateDrawablesLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
public void resolveWithLayoutDirection(int layoutDirection){
  mDrawableLeft=mDrawableLeftInitial;
  mDrawableRight=mDrawableRightInitial;
  if (mIsRtlCompatibilityMode) {
    if (mDrawableStart != null && mDrawableLeft == null) {
      mDrawableLeft=mDrawableStart;
      mDrawableSizeLeft=mDrawableSizeStart;
      mDrawableHeightLeft=mDrawableHeightStart;
    }
    if (mDrawableEnd != null && mDrawableRight == null) {
      mDrawableRight=mDrawableEnd;
      mDrawableSizeRight=mDrawableSizeEnd;
      mDrawableHeightRight=mDrawableHeightEnd;
    }
  }
 else {
switch (layoutDirection) {
case LAYOUT_DIRECTION_RTL:
      if (mOverride) {
        mDrawableRight=mDrawableStart;
        mDrawableSizeRight=mDrawableSizeStart;
        mDrawableHeightRight=mDrawableHeightStart;
      }
    if (mOverride) {
      mDrawableLeft=mDrawableEnd;
      mDrawableSizeLeft=mDrawableSizeEnd;
      mDrawableHeightLeft=mDrawableHeightEnd;
    }
  break;
case LAYOUT_DIRECTION_LTR:
default :
if (mOverride) {
  mDrawableLeft=mDrawableStart;
  mDrawableSizeLeft=mDrawableSizeStart;
  mDrawableHeightLeft=mDrawableHeightStart;
}
if (mOverride) {
mDrawableRight=mDrawableEnd;
mDrawableSizeRight=mDrawableSizeEnd;
mDrawableHeightRight=mDrawableHeightEnd;
}
break;
}
}
applyErrorDrawableIfNeeded(layoutDirection);
updateDrawablesLayoutDirection(layoutDirection);
}
Program: 2654
Project: 2654
Buggy source:
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables();
    }
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
  }
}

Fixed version (ground truth):
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    mDrawables.mOverride=true;
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
  }
}
Program: 2655
Project: 2655
Buggy source:
private void setErrorIcon(Drawable icon){
  Drawables dr=mTextView.mDrawables;
  if (dr == null) {
    mTextView.mDrawables=dr=new Drawables();
  }
  dr.setErrorDrawable(icon,mTextView);
  mTextView.resetResolvedDrawables();
  mTextView.invalidate();
  mTextView.requestLayout();
}

Fixed version (ground truth):
private void setErrorIcon(Drawable icon){
  Drawables dr=mTextView.mDrawables;
  if (dr == null) {
    mTextView.mDrawables=dr=new Drawables(mTextView.getContext());
  }
  dr.setErrorDrawable(icon,mTextView);
  mTextView.resetResolvedDrawables();
  mTextView.invalidate();
  mTextView.requestLayout();
}
Program: 2656
Project: 2656
Buggy source:
/** 
 * Sets the size of the padding between the compound drawables and the text.
 * @attr ref android.R.styleable#TextView_drawablePadding
 */
@android.view.RemotableViewMethod public void setCompoundDrawablePadding(int pad){
  Drawables dr=mDrawables;
  if (pad == 0) {
    if (dr != null) {
      dr.mDrawablePadding=pad;
    }
  }
 else {
    if (dr == null) {
      mDrawables=dr=new Drawables();
    }
    dr.mDrawablePadding=pad;
  }
  invalidate();
  requestLayout();
}

Fixed version (ground truth):
/** 
 * Sets the size of the padding between the compound drawables and the text.
 * @attr ref android.R.styleable#TextView_drawablePadding
 */
@android.view.RemotableViewMethod public void setCompoundDrawablePadding(int pad){
  Drawables dr=mDrawables;
  if (pad == 0) {
    if (dr != null) {
      dr.mDrawablePadding=pad;
    }
  }
 else {
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    dr.mDrawablePadding=pad;
  }
  invalidate();
  requestLayout();
}
Program: 2658
Project: 2658
Buggy source:
/** 
 * Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.  Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
 * @attr ref android.R.styleable#TextView_drawableStart
 * @attr ref android.R.styleable#TextView_drawableTop
 * @attr ref android.R.styleable#TextView_drawableEnd
 * @attr ref android.R.styleable#TextView_drawableBottom
 */
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start,Drawable top,Drawable end,Drawable bottom){
  resetResolvedDrawables();
  if (start != null) {
    start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
  }
  if (end != null) {
    end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
  }
  if (top != null) {
    top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());
  }
  if (bottom != null) {
    bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());
  }
  setCompoundDrawablesRelative(start,top,end,bottom);
}

Fixed version (ground truth):
/** 
 * Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.  Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
 * @attr ref android.R.styleable#TextView_drawableStart
 * @attr ref android.R.styleable#TextView_drawableTop
 * @attr ref android.R.styleable#TextView_drawableEnd
 * @attr ref android.R.styleable#TextView_drawableBottom
 */
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start,Drawable top,Drawable end,Drawable bottom){
  if (start != null) {
    start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
  }
  if (end != null) {
    end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
  }
  if (top != null) {
    top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());
  }
  if (bottom != null) {
    bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());
  }
  setCompoundDrawablesRelative(start,top,end,bottom);
}
Program: 2659
Project: 2659
Buggy source:
public void resolveWithLayoutDirection(int layoutDirection){
switch (layoutDirection) {
case LAYOUT_DIRECTION_RTL:
    if (mDrawableStart != null) {
      mDrawableRight=mDrawableStart;
      mDrawableSizeRight=mDrawableSizeStart;
      mDrawableHeightRight=mDrawableHeightStart;
    }
  if (mDrawableEnd != null) {
    mDrawableLeft=mDrawableEnd;
    mDrawableSizeLeft=mDrawableSizeEnd;
    mDrawableHeightLeft=mDrawableHeightEnd;
  }
break;
case LAYOUT_DIRECTION_LTR:
default :
if (mDrawableStart != null) {
mDrawableLeft=mDrawableStart;
mDrawableSizeLeft=mDrawableSizeStart;
mDrawableHeightLeft=mDrawableHeightStart;
}
if (mDrawableEnd != null) {
mDrawableRight=mDrawableEnd;
mDrawableSizeRight=mDrawableSizeEnd;
mDrawableHeightRight=mDrawableHeightEnd;
}
break;
}
applyErrorDrawableIfNeeded(layoutDirection);
updateDrawablesLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
public void resolveWithLayoutDirection(int layoutDirection){
  mDrawableLeft=mDrawableLeftInitial;
  mDrawableRight=mDrawableRightInitial;
  if (mIsRtlCompatibilityMode) {
    if (mDrawableStart != null && mDrawableLeft == null) {
      mDrawableLeft=mDrawableStart;
      mDrawableSizeLeft=mDrawableSizeStart;
      mDrawableHeightLeft=mDrawableHeightStart;
    }
    if (mDrawableEnd != null && mDrawableRight == null) {
      mDrawableRight=mDrawableEnd;
      mDrawableSizeRight=mDrawableSizeEnd;
      mDrawableHeightRight=mDrawableHeightEnd;
    }
  }
 else {
switch (layoutDirection) {
case LAYOUT_DIRECTION_RTL:
      if (mOverride) {
        mDrawableRight=mDrawableStart;
        mDrawableSizeRight=mDrawableSizeStart;
        mDrawableHeightRight=mDrawableHeightStart;
      }
    if (mOverride) {
      mDrawableLeft=mDrawableEnd;
      mDrawableSizeLeft=mDrawableSizeEnd;
      mDrawableHeightLeft=mDrawableHeightEnd;
    }
  break;
case LAYOUT_DIRECTION_LTR:
default :
if (mOverride) {
  mDrawableLeft=mDrawableStart;
  mDrawableSizeLeft=mDrawableSizeStart;
  mDrawableHeightLeft=mDrawableHeightStart;
}
if (mOverride) {
mDrawableRight=mDrawableEnd;
mDrawableSizeRight=mDrawableSizeEnd;
mDrawableHeightRight=mDrawableHeightEnd;
}
break;
}
}
applyErrorDrawableIfNeeded(layoutDirection);
updateDrawablesLayoutDirection(layoutDirection);
}
Program: 2661
Project: 2661
Buggy source:
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables();
    }
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
  }
}

Fixed version (ground truth):
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    mDrawables.mOverride=true;
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
  }
}
Program: 2662
Project: 2662
Buggy source:
/** 
 * Put a view into the ScrapViews list. These views are unordered.
 * @param scrap The view to add
 */
void addScrapView(View scrap,int position){
  AbsListView.LayoutParams lp=(AbsListView.LayoutParams)scrap.getLayoutParams();
  if (lp == null) {
    return;
  }
  lp.scrappedFromPosition=position;
  int viewType=lp.viewType;
  final boolean scrapHasTransientState=scrap.hasTransientState();
  if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
    if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER || scrapHasTransientState) {
      if (mSkippedScrap == null) {
        mSkippedScrap=new ArrayList<View>();
      }
      mSkippedScrap.add(scrap);
    }
    if (scrapHasTransientState) {
      scrap.dispatchStartTemporaryDetach();
      if (mAdapter != null && mAdapterHasStableIds) {
        if (mTransientStateViewsById == null) {
          mTransientStateViewsById=new LongSparseArray<View>();
        }
        mTransientStateViewsById.put(lp.itemId,scrap);
      }
 else {
        if (mTransientStateViews == null) {
          mTransientStateViews=new SparseArray<View>();
        }
        mTransientStateViews.put(position,scrap);
      }
    }
    return;
  }
  scrap.dispatchStartTemporaryDetach();
  if (mViewTypeCount == 1) {
    mCurrentScrap.add(scrap);
  }
 else {
    mScrapViews[viewType].add(scrap);
  }
  scrap.setAccessibilityDelegate(null);
  if (mRecyclerListener != null) {
    mRecyclerListener.onMovedToScrapHeap(scrap);
  }
}

Fixed version (ground truth):
/** 
 * Put a view into the ScrapViews list. These views are unordered.
 * @param scrap The view to add
 */
void addScrapView(View scrap,int position){
  AbsListView.LayoutParams lp=(AbsListView.LayoutParams)scrap.getLayoutParams();
  if (lp == null) {
    return;
  }
  lp.scrappedFromPosition=position;
  int viewType=lp.viewType;
  final boolean scrapHasTransientState=scrap.hasTransientState();
  if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
    if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER || scrapHasTransientState) {
      if (mSkippedScrap == null) {
        mSkippedScrap=new ArrayList<View>();
      }
      mSkippedScrap.add(scrap);
    }
    if (scrapHasTransientState) {
      scrap.dispatchStartTemporaryDetach();
      if (mAdapter != null && mAdapterHasStableIds) {
        if (mTransientStateViewsById == null) {
          mTransientStateViewsById=new LongSparseArray<View>();
        }
        mTransientStateViewsById.put(lp.itemId,scrap);
      }
 else       if (!mDataChanged) {
        if (mTransientStateViews == null) {
          mTransientStateViews=new SparseArray<View>();
        }
        mTransientStateViews.put(position,scrap);
      }
    }
    return;
  }
  scrap.dispatchStartTemporaryDetach();
  if (mViewTypeCount == 1) {
    mCurrentScrap.add(scrap);
  }
 else {
    mScrapViews[viewType].add(scrap);
  }
  scrap.setAccessibilityDelegate(null);
  if (mRecyclerListener != null) {
    mRecyclerListener.onMovedToScrapHeap(scrap);
  }
}
Program: 2663
Project: 2663
Buggy source:
/** 
 * Put a view into the ScrapViews list. These views are unordered.
 * @param scrap The view to add
 */
void addScrapView(View scrap,int position){
  AbsListView.LayoutParams lp=(AbsListView.LayoutParams)scrap.getLayoutParams();
  if (lp == null) {
    return;
  }
  lp.scrappedFromPosition=position;
  int viewType=lp.viewType;
  final boolean scrapHasTransientState=scrap.hasTransientState();
  if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
    if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER || scrapHasTransientState) {
      if (mSkippedScrap == null) {
        mSkippedScrap=new ArrayList<View>();
      }
      mSkippedScrap.add(scrap);
    }
    if (scrapHasTransientState) {
      scrap.dispatchStartTemporaryDetach();
      if (mAdapter != null && mAdapterHasStableIds) {
        if (mTransientStateViewsById == null) {
          mTransientStateViewsById=new LongSparseArray<View>();
        }
        mTransientStateViewsById.put(lp.itemId,scrap);
      }
 else {
        if (mTransientStateViews == null) {
          mTransientStateViews=new SparseArray<View>();
        }
        mTransientStateViews.put(position,scrap);
      }
    }
    return;
  }
  scrap.dispatchStartTemporaryDetach();
  if (mViewTypeCount == 1) {
    mCurrentScrap.add(scrap);
  }
 else {
    mScrapViews[viewType].add(scrap);
  }
  scrap.setAccessibilityDelegate(null);
  if (mRecyclerListener != null) {
    mRecyclerListener.onMovedToScrapHeap(scrap);
  }
}

Fixed version (ground truth):
/** 
 * Put a view into the ScrapViews list. These views are unordered.
 * @param scrap The view to add
 */
void addScrapView(View scrap,int position){
  AbsListView.LayoutParams lp=(AbsListView.LayoutParams)scrap.getLayoutParams();
  if (lp == null) {
    return;
  }
  lp.scrappedFromPosition=position;
  int viewType=lp.viewType;
  final boolean scrapHasTransientState=scrap.hasTransientState();
  if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
    if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER || scrapHasTransientState) {
      if (mSkippedScrap == null) {
        mSkippedScrap=new ArrayList<View>();
      }
      mSkippedScrap.add(scrap);
    }
    if (scrapHasTransientState) {
      scrap.dispatchStartTemporaryDetach();
      if (mAdapter != null && mAdapterHasStableIds) {
        if (mTransientStateViewsById == null) {
          mTransientStateViewsById=new LongSparseArray<View>();
        }
        mTransientStateViewsById.put(lp.itemId,scrap);
      }
 else       if (!mDataChanged) {
        if (mTransientStateViews == null) {
          mTransientStateViews=new SparseArray<View>();
        }
        mTransientStateViews.put(position,scrap);
      }
    }
    return;
  }
  scrap.dispatchStartTemporaryDetach();
  if (mViewTypeCount == 1) {
    mCurrentScrap.add(scrap);
  }
 else {
    mScrapViews[viewType].add(scrap);
  }
  scrap.setAccessibilityDelegate(null);
  if (mRecyclerListener != null) {
    mRecyclerListener.onMovedToScrapHeap(scrap);
  }
}
Program: 2664
Project: 2664
Buggy source:
/** 
 * Put a view into the ScrapViews list. These views are unordered.
 * @param scrap The view to add
 */
void addScrapView(View scrap,int position){
  AbsListView.LayoutParams lp=(AbsListView.LayoutParams)scrap.getLayoutParams();
  if (lp == null) {
    return;
  }
  lp.scrappedFromPosition=position;
  int viewType=lp.viewType;
  final boolean scrapHasTransientState=scrap.hasTransientState();
  if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
    if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER || scrapHasTransientState) {
      if (mSkippedScrap == null) {
        mSkippedScrap=new ArrayList<View>();
      }
      mSkippedScrap.add(scrap);
    }
    if (scrapHasTransientState) {
      scrap.dispatchStartTemporaryDetach();
      if (mAdapter != null && mAdapterHasStableIds) {
        if (mTransientStateViewsById == null) {
          mTransientStateViewsById=new LongSparseArray<View>();
        }
        mTransientStateViewsById.put(lp.itemId,scrap);
      }
 else {
        if (mTransientStateViews == null) {
          mTransientStateViews=new SparseArray<View>();
        }
        mTransientStateViews.put(position,scrap);
      }
    }
    return;
  }
  scrap.dispatchStartTemporaryDetach();
  if (mViewTypeCount == 1) {
    mCurrentScrap.add(scrap);
  }
 else {
    mScrapViews[viewType].add(scrap);
  }
  scrap.setAccessibilityDelegate(null);
  if (mRecyclerListener != null) {
    mRecyclerListener.onMovedToScrapHeap(scrap);
  }
}

Fixed version (ground truth):
/** 
 * Put a view into the ScrapViews list. These views are unordered.
 * @param scrap The view to add
 */
void addScrapView(View scrap,int position){
  AbsListView.LayoutParams lp=(AbsListView.LayoutParams)scrap.getLayoutParams();
  if (lp == null) {
    return;
  }
  lp.scrappedFromPosition=position;
  int viewType=lp.viewType;
  final boolean scrapHasTransientState=scrap.hasTransientState();
  if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
    if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER || scrapHasTransientState) {
      if (mSkippedScrap == null) {
        mSkippedScrap=new ArrayList<View>();
      }
      mSkippedScrap.add(scrap);
    }
    if (scrapHasTransientState) {
      scrap.dispatchStartTemporaryDetach();
      if (mAdapter != null && mAdapterHasStableIds) {
        if (mTransientStateViewsById == null) {
          mTransientStateViewsById=new LongSparseArray<View>();
        }
        mTransientStateViewsById.put(lp.itemId,scrap);
      }
 else       if (!mDataChanged) {
        if (mTransientStateViews == null) {
          mTransientStateViews=new SparseArray<View>();
        }
        mTransientStateViews.put(position,scrap);
      }
    }
    return;
  }
  scrap.dispatchStartTemporaryDetach();
  if (mViewTypeCount == 1) {
    mCurrentScrap.add(scrap);
  }
 else {
    mScrapViews[viewType].add(scrap);
  }
  scrap.setAccessibilityDelegate(null);
  if (mRecyclerListener != null) {
    mRecyclerListener.onMovedToScrapHeap(scrap);
  }
}
Program: 2665
Project: 2665
Buggy source:
private void setErrorIcon(Drawable icon){
  Drawables dr=mTextView.mDrawables;
  if (dr == null) {
    mTextView.mDrawables=dr=new Drawables();
  }
  dr.setErrorDrawable(icon,mTextView);
  mTextView.resetResolvedDrawables();
  mTextView.invalidate();
  mTextView.requestLayout();
}

Fixed version (ground truth):
private void setErrorIcon(Drawable icon){
  Drawables dr=mTextView.mDrawables;
  if (dr == null) {
    mTextView.mDrawables=dr=new Drawables(mTextView.getContext());
  }
  dr.setErrorDrawable(icon,mTextView);
  mTextView.resetResolvedDrawables();
  mTextView.invalidate();
  mTextView.requestLayout();
}
Program: 2666
Project: 2666
Buggy source:
/** 
 * Sets the size of the padding between the compound drawables and the text.
 * @attr ref android.R.styleable#TextView_drawablePadding
 */
@android.view.RemotableViewMethod public void setCompoundDrawablePadding(int pad){
  Drawables dr=mDrawables;
  if (pad == 0) {
    if (dr != null) {
      dr.mDrawablePadding=pad;
    }
  }
 else {
    if (dr == null) {
      mDrawables=dr=new Drawables();
    }
    dr.mDrawablePadding=pad;
  }
  invalidate();
  requestLayout();
}

Fixed version (ground truth):
/** 
 * Sets the size of the padding between the compound drawables and the text.
 * @attr ref android.R.styleable#TextView_drawablePadding
 */
@android.view.RemotableViewMethod public void setCompoundDrawablePadding(int pad){
  Drawables dr=mDrawables;
  if (pad == 0) {
    if (dr != null) {
      dr.mDrawablePadding=pad;
    }
  }
 else {
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    dr.mDrawablePadding=pad;
  }
  invalidate();
  requestLayout();
}
Program: 2668
Project: 2668
Buggy source:
/** 
 * Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.  Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
 * @attr ref android.R.styleable#TextView_drawableStart
 * @attr ref android.R.styleable#TextView_drawableTop
 * @attr ref android.R.styleable#TextView_drawableEnd
 * @attr ref android.R.styleable#TextView_drawableBottom
 */
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start,Drawable top,Drawable end,Drawable bottom){
  resetResolvedDrawables();
  if (start != null) {
    start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
  }
  if (end != null) {
    end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
  }
  if (top != null) {
    top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());
  }
  if (bottom != null) {
    bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());
  }
  setCompoundDrawablesRelative(start,top,end,bottom);
}

Fixed version (ground truth):
/** 
 * Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.  Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
 * @attr ref android.R.styleable#TextView_drawableStart
 * @attr ref android.R.styleable#TextView_drawableTop
 * @attr ref android.R.styleable#TextView_drawableEnd
 * @attr ref android.R.styleable#TextView_drawableBottom
 */
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start,Drawable top,Drawable end,Drawable bottom){
  if (start != null) {
    start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
  }
  if (end != null) {
    end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
  }
  if (top != null) {
    top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());
  }
  if (bottom != null) {
    bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());
  }
  setCompoundDrawablesRelative(start,top,end,bottom);
}
Program: 2669
Project: 2669
Buggy source:
public void resolveWithLayoutDirection(int layoutDirection){
switch (layoutDirection) {
case LAYOUT_DIRECTION_RTL:
    if (mDrawableStart != null) {
      mDrawableRight=mDrawableStart;
      mDrawableSizeRight=mDrawableSizeStart;
      mDrawableHeightRight=mDrawableHeightStart;
    }
  if (mDrawableEnd != null) {
    mDrawableLeft=mDrawableEnd;
    mDrawableSizeLeft=mDrawableSizeEnd;
    mDrawableHeightLeft=mDrawableHeightEnd;
  }
break;
case LAYOUT_DIRECTION_LTR:
default :
if (mDrawableStart != null) {
mDrawableLeft=mDrawableStart;
mDrawableSizeLeft=mDrawableSizeStart;
mDrawableHeightLeft=mDrawableHeightStart;
}
if (mDrawableEnd != null) {
mDrawableRight=mDrawableEnd;
mDrawableSizeRight=mDrawableSizeEnd;
mDrawableHeightRight=mDrawableHeightEnd;
}
break;
}
applyErrorDrawableIfNeeded(layoutDirection);
updateDrawablesLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
public void resolveWithLayoutDirection(int layoutDirection){
  mDrawableLeft=mDrawableLeftInitial;
  mDrawableRight=mDrawableRightInitial;
  if (mIsRtlCompatibilityMode) {
    if (mDrawableStart != null && mDrawableLeft == null) {
      mDrawableLeft=mDrawableStart;
      mDrawableSizeLeft=mDrawableSizeStart;
      mDrawableHeightLeft=mDrawableHeightStart;
    }
    if (mDrawableEnd != null && mDrawableRight == null) {
      mDrawableRight=mDrawableEnd;
      mDrawableSizeRight=mDrawableSizeEnd;
      mDrawableHeightRight=mDrawableHeightEnd;
    }
  }
 else {
switch (layoutDirection) {
case LAYOUT_DIRECTION_RTL:
      if (mOverride) {
        mDrawableRight=mDrawableStart;
        mDrawableSizeRight=mDrawableSizeStart;
        mDrawableHeightRight=mDrawableHeightStart;
      }
    if (mOverride) {
      mDrawableLeft=mDrawableEnd;
      mDrawableSizeLeft=mDrawableSizeEnd;
      mDrawableHeightLeft=mDrawableHeightEnd;
    }
  break;
case LAYOUT_DIRECTION_LTR:
default :
if (mOverride) {
  mDrawableLeft=mDrawableStart;
  mDrawableSizeLeft=mDrawableSizeStart;
  mDrawableHeightLeft=mDrawableHeightStart;
}
if (mOverride) {
mDrawableRight=mDrawableEnd;
mDrawableSizeRight=mDrawableSizeEnd;
mDrawableHeightRight=mDrawableHeightEnd;
}
break;
}
}
applyErrorDrawableIfNeeded(layoutDirection);
updateDrawablesLayoutDirection(layoutDirection);
}
Program: 2671
Project: 2671
Buggy source:
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables();
    }
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
  }
}

Fixed version (ground truth):
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    mDrawables.mOverride=true;
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
  }
}
Program: 2672
Project: 2672
Buggy source:
/** 
 * Put a view into the ScrapViews list. These views are unordered.
 * @param scrap The view to add
 */
void addScrapView(View scrap,int position){
  AbsListView.LayoutParams lp=(AbsListView.LayoutParams)scrap.getLayoutParams();
  if (lp == null) {
    return;
  }
  lp.scrappedFromPosition=position;
  int viewType=lp.viewType;
  final boolean scrapHasTransientState=scrap.hasTransientState();
  if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
    if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER || scrapHasTransientState) {
      if (mSkippedScrap == null) {
        mSkippedScrap=new ArrayList<View>();
      }
      mSkippedScrap.add(scrap);
    }
    if (scrapHasTransientState) {
      scrap.dispatchStartTemporaryDetach();
      if (mAdapter != null && mAdapterHasStableIds) {
        if (mTransientStateViewsById == null) {
          mTransientStateViewsById=new LongSparseArray<View>();
        }
        mTransientStateViewsById.put(lp.itemId,scrap);
      }
 else {
        if (mTransientStateViews == null) {
          mTransientStateViews=new SparseArray<View>();
        }
        mTransientStateViews.put(position,scrap);
      }
    }
    return;
  }
  scrap.dispatchStartTemporaryDetach();
  if (mViewTypeCount == 1) {
    mCurrentScrap.add(scrap);
  }
 else {
    mScrapViews[viewType].add(scrap);
  }
  scrap.setAccessibilityDelegate(null);
  if (mRecyclerListener != null) {
    mRecyclerListener.onMovedToScrapHeap(scrap);
  }
}

Fixed version (ground truth):
/** 
 * Put a view into the ScrapViews list. These views are unordered.
 * @param scrap The view to add
 */
void addScrapView(View scrap,int position){
  AbsListView.LayoutParams lp=(AbsListView.LayoutParams)scrap.getLayoutParams();
  if (lp == null) {
    return;
  }
  lp.scrappedFromPosition=position;
  int viewType=lp.viewType;
  final boolean scrapHasTransientState=scrap.hasTransientState();
  if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
    if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER || scrapHasTransientState) {
      if (mSkippedScrap == null) {
        mSkippedScrap=new ArrayList<View>();
      }
      mSkippedScrap.add(scrap);
    }
    if (scrapHasTransientState) {
      scrap.dispatchStartTemporaryDetach();
      if (mAdapter != null && mAdapterHasStableIds) {
        if (mTransientStateViewsById == null) {
          mTransientStateViewsById=new LongSparseArray<View>();
        }
        mTransientStateViewsById.put(lp.itemId,scrap);
      }
 else       if (!mDataChanged) {
        if (mTransientStateViews == null) {
          mTransientStateViews=new SparseArray<View>();
        }
        mTransientStateViews.put(position,scrap);
      }
    }
    return;
  }
  scrap.dispatchStartTemporaryDetach();
  if (mViewTypeCount == 1) {
    mCurrentScrap.add(scrap);
  }
 else {
    mScrapViews[viewType].add(scrap);
  }
  scrap.setAccessibilityDelegate(null);
  if (mRecyclerListener != null) {
    mRecyclerListener.onMovedToScrapHeap(scrap);
  }
}
Program: 2673
Project: 2673
Buggy source:
public void postNotification(){
  final int appUid=appInfo.uid;
  final int appPid=app.pid;
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        NotificationManagerService nm=(NotificationManagerService)NotificationManager.getService();
        if (nm == null) {
          return;
        }
        try {
          int[] outId=new int[1];
          nm.enqueueNotificationInternal(localPackageName,localPackageName,appUid,appPid,null,localForegroundId,localForegroundNoti,outId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(ActivityManagerService.TAG,"String_Node_Str",e);
          ams.setServiceForeground(name,ServiceRecord.this,0,null,true);
          ams.crashApplication(appUid,appPid,localPackageName,"String_Node_Str" + e);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void postNotification(){
  final int appUid=appInfo.uid;
  final int appPid=app.pid;
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        NotificationManagerService nm=(NotificationManagerService)NotificationManager.getService();
        if (nm == null) {
          return;
        }
        try {
          if (foregroundNoti.icon == 0) {
            throw new RuntimeException("String_Node_Str");
          }
          int[] outId=new int[1];
          nm.enqueueNotificationInternal(localPackageName,localPackageName,appUid,appPid,null,localForegroundId,localForegroundNoti,outId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(ActivityManagerService.TAG,"String_Node_Str",e);
          ams.setServiceForeground(name,ServiceRecord.this,0,null,true);
          ams.crashApplication(appUid,appPid,localPackageName,"String_Node_Str" + e);
        }
      }
    }
);
  }
}
Program: 2674
Project: 2674
Buggy source:
public void postNotification(){
  final int appUid=appInfo.uid;
  final int appPid=app.pid;
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        NotificationManagerService nm=(NotificationManagerService)NotificationManager.getService();
        if (nm == null) {
          return;
        }
        try {
          int[] outId=new int[1];
          nm.enqueueNotificationInternal(localPackageName,localPackageName,appUid,appPid,null,localForegroundId,localForegroundNoti,outId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(ActivityManagerService.TAG,"String_Node_Str",e);
          ams.setServiceForeground(name,ServiceRecord.this,0,null,true);
          ams.crashApplication(appUid,appPid,localPackageName,"String_Node_Str" + e);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void postNotification(){
  final int appUid=appInfo.uid;
  final int appPid=app.pid;
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        NotificationManagerService nm=(NotificationManagerService)NotificationManager.getService();
        if (nm == null) {
          return;
        }
        try {
          if (foregroundNoti.icon == 0) {
            throw new RuntimeException("String_Node_Str");
          }
          int[] outId=new int[1];
          nm.enqueueNotificationInternal(localPackageName,localPackageName,appUid,appPid,null,localForegroundId,localForegroundNoti,outId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(ActivityManagerService.TAG,"String_Node_Str",e);
          ams.setServiceForeground(name,ServiceRecord.this,0,null,true);
          ams.crashApplication(appUid,appPid,localPackageName,"String_Node_Str" + e);
        }
      }
    }
);
  }
}
Program: 2675
Project: 2675
Buggy source:
public void postNotification(){
  final int appUid=appInfo.uid;
  final int appPid=app.pid;
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        NotificationManagerService nm=(NotificationManagerService)NotificationManager.getService();
        if (nm == null) {
          return;
        }
        try {
          int[] outId=new int[1];
          nm.enqueueNotificationInternal(localPackageName,localPackageName,appUid,appPid,null,localForegroundId,localForegroundNoti,outId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(ActivityManagerService.TAG,"String_Node_Str",e);
          ams.setServiceForeground(name,ServiceRecord.this,0,null,true);
          ams.crashApplication(appUid,appPid,localPackageName,"String_Node_Str" + e);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void postNotification(){
  final int appUid=appInfo.uid;
  final int appPid=app.pid;
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        NotificationManagerService nm=(NotificationManagerService)NotificationManager.getService();
        if (nm == null) {
          return;
        }
        try {
          if (foregroundNoti.icon == 0) {
            throw new RuntimeException("String_Node_Str");
          }
          int[] outId=new int[1];
          nm.enqueueNotificationInternal(localPackageName,localPackageName,appUid,appPid,null,localForegroundId,localForegroundNoti,outId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(ActivityManagerService.TAG,"String_Node_Str",e);
          ams.setServiceForeground(name,ServiceRecord.this,0,null,true);
          ams.crashApplication(appUid,appPid,localPackageName,"String_Node_Str" + e);
        }
      }
    }
);
  }
}
Program: 2676
Project: 2676
Buggy source:
public void postNotification(){
  final int appUid=appInfo.uid;
  final int appPid=app.pid;
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        NotificationManagerService nm=(NotificationManagerService)NotificationManager.getService();
        if (nm == null) {
          return;
        }
        try {
          int[] outId=new int[1];
          nm.enqueueNotificationInternal(localPackageName,localPackageName,appUid,appPid,null,localForegroundId,localForegroundNoti,outId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(ActivityManagerService.TAG,"String_Node_Str",e);
          ams.setServiceForeground(name,ServiceRecord.this,0,null,true);
          ams.crashApplication(appUid,appPid,localPackageName,"String_Node_Str" + e);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void postNotification(){
  final int appUid=appInfo.uid;
  final int appPid=app.pid;
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        NotificationManagerService nm=(NotificationManagerService)NotificationManager.getService();
        if (nm == null) {
          return;
        }
        try {
          if (foregroundNoti.icon == 0) {
            throw new RuntimeException("String_Node_Str");
          }
          int[] outId=new int[1];
          nm.enqueueNotificationInternal(localPackageName,localPackageName,appUid,appPid,null,localForegroundId,localForegroundNoti,outId,userId);
        }
 catch (        RuntimeException e) {
          Slog.w(ActivityManagerService.TAG,"String_Node_Str",e);
          ams.setServiceForeground(name,ServiceRecord.this,0,null,true);
          ams.crashApplication(appUid,appPid,localPackageName,"String_Node_Str" + e);
        }
      }
    }
);
  }
}
Program: 2677
Project: 2677
Buggy source:
/** 
 * Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside of the current clip. Call this to check if an area you intend to draw into is clipped out (and therefore you can skip making the draw calls).
 * @param left        The left side of the rectangle to compare with thecurrent clip
 * @param top         The top of the rectangle to compare with the currentclip
 * @param right       The right side of the rectangle to compare with thecurrent clip
 * @param bottom      The bottom of the rectangle to compare with thecurrent clip
 * @param type        true if the rect should be considered antialiased,since that means it may affect a larger area (more pixels) than non-antialiased.
 * @return            true if the rect (transformed by the canvas' matrix)does not intersect with the canvas' clip
 */
public boolean quickReject(float left,float top,float right,float bottom,EdgeType type){
  return native_quickReject(mNativeCanvas,left,top,right,bottom);
}

Fixed version (ground truth):
/** 
 * Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside of the current clip. Call this to check if an area you intend to draw into is clipped out (and therefore you can skip making the draw calls).
 * @param left        The left side of the rectangle to compare with thecurrent clip
 * @param top         The top of the rectangle to compare with the currentclip
 * @param right       The right side of the rectangle to compare with thecurrent clip
 * @param bottom      The bottom of the rectangle to compare with thecurrent clip
 * @param type        {@link Canvas.EdgeType#AA} if the path should be considered antialiased,since that means it may affect a larger area (more pixels) than non-antialiased ( {@link Canvas.EdgeType#BW}).
 * @return            true if the rect (transformed by the canvas' matrix)does not intersect with the canvas' clip
 */
public boolean quickReject(float left,float top,float right,float bottom,EdgeType type){
  return native_quickReject(mNativeCanvas,left,top,right,bottom);
}