nus-yam/ex-repair huggingface dataset:
Program: 1993
Project: 1993
Buggy source:
public AnimatedRotateState(AnimatedRotateState source,AnimatedRotateDrawable owner,Resources res){
  if (source != null) {
    if (res != null) {
      mDrawable=source.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=source.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mPivotXRel=source.mPivotXRel;
    mPivotX=source.mPivotX;
    mPivotYRel=source.mPivotYRel;
    mPivotY=source.mPivotY;
    mFramesCount=source.mFramesCount;
    mFrameDuration=source.mFrameDuration;
    mCanConstantState=mCheckedConstantState=true;
  }
}

Fixed version (ground truth):
public AnimatedRotateState(AnimatedRotateState source,AnimatedRotateDrawable owner,Resources res){
  if (source != null) {
    if (res != null) {
      mDrawable=source.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=source.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(source.mDrawable.getLayoutDirection());
    mPivotXRel=source.mPivotXRel;
    mPivotX=source.mPivotX;
    mPivotYRel=source.mPivotYRel;
    mPivotY=source.mPivotY;
    mFramesCount=source.mFramesCount;
    mFrameDuration=source.mFrameDuration;
    mCanConstantState=mCheckedConstantState=true;
  }
}
Program: 1994
Project: 1994
Buggy source:
ClipState(ClipState orig,ClipDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mOrientation=orig.mOrientation;
    mGravity=orig.mGravity;
    mCheckedConstantState=mCanConstantState=true;
  }
}

Fixed version (ground truth):
ClipState(ClipState orig,ClipDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());
    mOrientation=orig.mOrientation;
    mGravity=orig.mGravity;
    mCheckedConstantState=mCanConstantState=true;
  }
}
Program: 1995
Project: 1995
Buggy source:
DrawableContainerState(DrawableContainerState orig,DrawableContainer owner,Resources res){
  mOwner=owner;
  if (orig != null) {
    mChangingConfigurations=orig.mChangingConfigurations;
    mChildrenChangingConfigurations=orig.mChildrenChangingConfigurations;
    final Drawable[] origDr=orig.mDrawables;
    mDrawables=new Drawable[origDr.length];
    mNumChildren=orig.mNumChildren;
    final int N=mNumChildren;
    for (int i=0; i < N; i++) {
      if (res != null) {
        mDrawables[i]=origDr[i].getConstantState().newDrawable(res);
      }
 else {
        mDrawables[i]=origDr[i].getConstantState().newDrawable();
      }
      mDrawables[i].setCallback(owner);
    }
    mCheckedConstantState=mCanConstantState=true;
    mVariablePadding=orig.mVariablePadding;
    if (orig.mConstantPadding != null) {
      mConstantPadding=new Rect(orig.mConstantPadding);
    }
    mConstantSize=orig.mConstantSize;
    mComputedConstantSize=orig.mComputedConstantSize;
    mConstantWidth=orig.mConstantWidth;
    mConstantHeight=orig.mConstantHeight;
    mConstantMinimumWidth=orig.mConstantMinimumWidth;
    mConstantMinimumHeight=orig.mConstantMinimumHeight;
    mOpacity=orig.mOpacity;
    mHaveStateful=orig.mHaveStateful;
    mStateful=orig.mStateful;
    mDither=orig.mDither;
    mEnterFadeDuration=orig.mEnterFadeDuration;
    mExitFadeDuration=orig.mExitFadeDuration;
  }
 else {
    mDrawables=new Drawable[10];
    mNumChildren=0;
    mCheckedConstantState=mCanConstantState=false;
  }
}

Fixed version (ground truth):
DrawableContainerState(DrawableContainerState orig,DrawableContainer owner,Resources res){
  mOwner=owner;
  if (orig != null) {
    mChangingConfigurations=orig.mChangingConfigurations;
    mChildrenChangingConfigurations=orig.mChildrenChangingConfigurations;
    final Drawable[] origDr=orig.mDrawables;
    mDrawables=new Drawable[origDr.length];
    mNumChildren=orig.mNumChildren;
    final int N=mNumChildren;
    for (int i=0; i < N; i++) {
      if (res != null) {
        mDrawables[i]=origDr[i].getConstantState().newDrawable(res);
      }
 else {
        mDrawables[i]=origDr[i].getConstantState().newDrawable();
      }
      mDrawables[i].setCallback(owner);
      mDrawables[i].setLayoutDirection(origDr[i].getLayoutDirection());
    }
    mCheckedConstantState=mCanConstantState=true;
    mVariablePadding=orig.mVariablePadding;
    if (orig.mConstantPadding != null) {
      mConstantPadding=new Rect(orig.mConstantPadding);
    }
    mConstantSize=orig.mConstantSize;
    mComputedConstantSize=orig.mComputedConstantSize;
    mConstantWidth=orig.mConstantWidth;
    mConstantHeight=orig.mConstantHeight;
    mConstantMinimumWidth=orig.mConstantMinimumWidth;
    mConstantMinimumHeight=orig.mConstantMinimumHeight;
    mOpacity=orig.mOpacity;
    mHaveStateful=orig.mHaveStateful;
    mStateful=orig.mStateful;
    mDither=orig.mDither;
    mEnterFadeDuration=orig.mEnterFadeDuration;
    mExitFadeDuration=orig.mExitFadeDuration;
  }
 else {
    mDrawables=new Drawable[10];
    mNumChildren=0;
    mCheckedConstantState=mCanConstantState=false;
  }
}
Program: 1997
Project: 1997
Buggy source:
InsetState(InsetState orig,InsetDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mInsetLeft=orig.mInsetLeft;
    mInsetTop=orig.mInsetTop;
    mInsetRight=orig.mInsetRight;
    mInsetBottom=orig.mInsetBottom;
    mCheckedConstantState=mCanConstantState=true;
  }
}

Fixed version (ground truth):
InsetState(InsetState orig,InsetDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());
    mInsetLeft=orig.mInsetLeft;
    mInsetTop=orig.mInsetTop;
    mInsetRight=orig.mInsetRight;
    mInsetBottom=orig.mInsetBottom;
    mCheckedConstantState=mCanConstantState=true;
  }
}
Program: 1998
Project: 1998
Buggy source:
/** 
 * @hide 
 */
@Override public void setLayoutDirection(int layoutDirection){
  if (getLayoutDirection() != layoutDirection) {
    final ChildDrawable[] array=mLayerState.mChildren;
    final int N=mLayerState.mNum;
    for (int i=0; i < N; i++) {
      array[i].mDrawable.setLayoutDirection(layoutDirection);
    }
  }
  super.setLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
/** 
 * @hide 
 */
@Override public void setLayoutDirection(int layoutDirection){
  final ChildDrawable[] array=mLayerState.mChildren;
  final int N=mLayerState.mNum;
  for (int i=0; i < N; i++) {
    array[i].mDrawable.setLayoutDirection(layoutDirection);
  }
  super.setLayoutDirection(layoutDirection);
}
Program: 1999
Project: 1999
Buggy source:
LayerState(LayerState orig,LayerDrawable owner,Resources res){
  if (orig != null) {
    final ChildDrawable[] origChildDrawable=orig.mChildren;
    final int N=orig.mNum;
    mNum=N;
    mChildren=new ChildDrawable[N];
    mChangingConfigurations=orig.mChangingConfigurations;
    mChildrenChangingConfigurations=orig.mChildrenChangingConfigurations;
    for (int i=0; i < N; i++) {
      final ChildDrawable r=mChildren[i]=new ChildDrawable();
      final ChildDrawable or=origChildDrawable[i];
      if (res != null) {
        r.mDrawable=or.mDrawable.getConstantState().newDrawable(res);
      }
 else {
        r.mDrawable=or.mDrawable.getConstantState().newDrawable();
      }
      r.mDrawable.setCallback(owner);
      r.mInsetL=or.mInsetL;
      r.mInsetT=or.mInsetT;
      r.mInsetR=or.mInsetR;
      r.mInsetB=or.mInsetB;
      r.mId=or.mId;
    }
    mHaveOpacity=orig.mHaveOpacity;
    mOpacity=orig.mOpacity;
    mHaveStateful=orig.mHaveStateful;
    mStateful=orig.mStateful;
    mCheckedConstantState=mCanConstantState=true;
  }
 else {
    mNum=0;
    mChildren=null;
  }
}

Fixed version (ground truth):
LayerState(LayerState orig,LayerDrawable owner,Resources res){
  if (orig != null) {
    final ChildDrawable[] origChildDrawable=orig.mChildren;
    final int N=orig.mNum;
    mNum=N;
    mChildren=new ChildDrawable[N];
    mChangingConfigurations=orig.mChangingConfigurations;
    mChildrenChangingConfigurations=orig.mChildrenChangingConfigurations;
    for (int i=0; i < N; i++) {
      final ChildDrawable r=mChildren[i]=new ChildDrawable();
      final ChildDrawable or=origChildDrawable[i];
      if (res != null) {
        r.mDrawable=or.mDrawable.getConstantState().newDrawable(res);
      }
 else {
        r.mDrawable=or.mDrawable.getConstantState().newDrawable();
      }
      r.mDrawable.setCallback(owner);
      r.mDrawable.setLayoutDirection(or.mDrawable.getLayoutDirection());
      r.mInsetL=or.mInsetL;
      r.mInsetT=or.mInsetT;
      r.mInsetR=or.mInsetR;
      r.mInsetB=or.mInsetB;
      r.mId=or.mId;
    }
    mHaveOpacity=orig.mHaveOpacity;
    mOpacity=orig.mOpacity;
    mHaveStateful=orig.mHaveStateful;
    mStateful=orig.mStateful;
    mCheckedConstantState=mCanConstantState=true;
  }
 else {
    mNum=0;
    mChildren=null;
  }
}
Program: 2000
Project: 2000
Buggy source:
public RotateState(RotateState source,RotateDrawable owner,Resources res){
  if (source != null) {
    if (res != null) {
      mDrawable=source.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=source.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mPivotXRel=source.mPivotXRel;
    mPivotX=source.mPivotX;
    mPivotYRel=source.mPivotYRel;
    mPivotY=source.mPivotY;
    mFromDegrees=mCurrentDegrees=source.mFromDegrees;
    mToDegrees=source.mToDegrees;
    mCanConstantState=mCheckedConstantState=true;
  }
}

Fixed version (ground truth):
public RotateState(RotateState source,RotateDrawable owner,Resources res){
  if (source != null) {
    if (res != null) {
      mDrawable=source.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=source.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(source.mDrawable.getLayoutDirection());
    mPivotXRel=source.mPivotXRel;
    mPivotX=source.mPivotX;
    mPivotYRel=source.mPivotYRel;
    mPivotY=source.mPivotY;
    mFromDegrees=mCurrentDegrees=source.mFromDegrees;
    mToDegrees=source.mToDegrees;
    mCanConstantState=mCheckedConstantState=true;
  }
}
Program: 2001
Project: 2001
Buggy source:
ScaleState(ScaleState orig,ScaleDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mScaleWidth=orig.mScaleWidth;
    mScaleHeight=orig.mScaleHeight;
    mGravity=orig.mGravity;
    mUseIntrinsicSizeAsMin=orig.mUseIntrinsicSizeAsMin;
    mCheckedConstantState=mCanConstantState=true;
  }
}

Fixed version (ground truth):
ScaleState(ScaleState orig,ScaleDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());
    mScaleWidth=orig.mScaleWidth;
    mScaleHeight=orig.mScaleHeight;
    mGravity=orig.mGravity;
    mUseIntrinsicSizeAsMin=orig.mUseIntrinsicSizeAsMin;
    mCheckedConstantState=mCanConstantState=true;
  }
}
Program: 2002
Project: 2002
Buggy source:
public void moveTaskToTop(int taskId){
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      Task task=mTaskIdToTask.get(taskId);
      if (task == null) {
        Slog.e(TAG,"String_Node_Str" + taskId + "String_Node_Str");
        return;
      }
      final TaskStack stack=task.mStack;
      final DisplayContent displayContent=task.getDisplayContent();
      final boolean isHomeStackTask=stack.isHomeStack();
      final boolean homeIsOnTop=displayContent.homeOnTop();
      if (!isHomeStackTask && homeIsOnTop) {
        moveHomeTasksLocked(false);
        displayContent.moveHomeStackBox(false);
      }
 else       if (isHomeStackTask && !homeIsOnTop) {
        displayContent.moveHomeStackBox(true);
      }
      stack.moveTaskToTop(task);
      displayContent.moveStack(stack,true);
      moveTaskWindowsLocked(task);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
public void moveTaskToTop(int taskId){
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      Task task=mTaskIdToTask.get(taskId);
      if (task == null) {
        Slog.e(TAG,"String_Node_Str" + taskId + "String_Node_Str");
        return;
      }
      final TaskStack stack=task.mStack;
      final DisplayContent displayContent=task.getDisplayContent();
      final boolean isHomeStackTask=stack.isHomeStack();
      final boolean homeIsOnTop=displayContent.homeOnTop();
      if (!isHomeStackTask && homeIsOnTop) {
        moveHomeTasksLocked(false);
        displayContent.moveHomeStackBox(false);
      }
 else       if (isHomeStackTask && !homeIsOnTop) {
        displayContent.moveHomeStackBox(true);
      }
      stack.moveTaskToTop(task);
      displayContent.moveStack(stack,true);
      moveStackWindowsLocked(stack);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 2005
Project: 2005
Buggy source:
public void moveTaskToBottom(int taskId){
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      Task task=mTaskIdToTask.get(taskId);
      if (task == null) {
        Slog.e(TAG,"String_Node_Str" + taskId + "String_Node_Str");
        return;
      }
      task.mStack.moveTaskToBottom(task);
      moveTaskWindowsLocked(task);
      task.getDisplayContent().moveStack(task.mStack,false);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
public void moveTaskToBottom(int taskId){
  final long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      Task task=mTaskIdToTask.get(taskId);
      if (task == null) {
        Slog.e(TAG,"String_Node_Str" + taskId + "String_Node_Str");
        return;
      }
      final TaskStack stack=task.mStack;
      stack.moveTaskToBottom(task);
      task.getDisplayContent().moveStack(stack,false);
      moveStackWindowsLocked(stack);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 2010
Project: 2010
Buggy source:
public AnimatedRotateState(AnimatedRotateState source,AnimatedRotateDrawable owner,Resources res){
  if (source != null) {
    if (res != null) {
      mDrawable=source.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=source.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mPivotXRel=source.mPivotXRel;
    mPivotX=source.mPivotX;
    mPivotYRel=source.mPivotYRel;
    mPivotY=source.mPivotY;
    mFramesCount=source.mFramesCount;
    mFrameDuration=source.mFrameDuration;
    mCanConstantState=mCheckedConstantState=true;
  }
}

Fixed version (ground truth):
public AnimatedRotateState(AnimatedRotateState source,AnimatedRotateDrawable owner,Resources res){
  if (source != null) {
    if (res != null) {
      mDrawable=source.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=source.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(source.mDrawable.getLayoutDirection());
    mPivotXRel=source.mPivotXRel;
    mPivotX=source.mPivotX;
    mPivotYRel=source.mPivotYRel;
    mPivotY=source.mPivotY;
    mFramesCount=source.mFramesCount;
    mFrameDuration=source.mFrameDuration;
    mCanConstantState=mCheckedConstantState=true;
  }
}
Program: 2011
Project: 2011
Buggy source:
ClipState(ClipState orig,ClipDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mOrientation=orig.mOrientation;
    mGravity=orig.mGravity;
    mCheckedConstantState=mCanConstantState=true;
  }
}

Fixed version (ground truth):
ClipState(ClipState orig,ClipDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());
    mOrientation=orig.mOrientation;
    mGravity=orig.mGravity;
    mCheckedConstantState=mCanConstantState=true;
  }
}
Program: 2012
Project: 2012
Buggy source:
DrawableContainerState(DrawableContainerState orig,DrawableContainer owner,Resources res){
  mOwner=owner;
  if (orig != null) {
    mChangingConfigurations=orig.mChangingConfigurations;
    mChildrenChangingConfigurations=orig.mChildrenChangingConfigurations;
    final Drawable[] origDr=orig.mDrawables;
    mDrawables=new Drawable[origDr.length];
    mNumChildren=orig.mNumChildren;
    final int N=mNumChildren;
    for (int i=0; i < N; i++) {
      if (res != null) {
        mDrawables[i]=origDr[i].getConstantState().newDrawable(res);
      }
 else {
        mDrawables[i]=origDr[i].getConstantState().newDrawable();
      }
      mDrawables[i].setCallback(owner);
    }
    mCheckedConstantState=mCanConstantState=true;
    mVariablePadding=orig.mVariablePadding;
    if (orig.mConstantPadding != null) {
      mConstantPadding=new Rect(orig.mConstantPadding);
    }
    mConstantSize=orig.mConstantSize;
    mComputedConstantSize=orig.mComputedConstantSize;
    mConstantWidth=orig.mConstantWidth;
    mConstantHeight=orig.mConstantHeight;
    mConstantMinimumWidth=orig.mConstantMinimumWidth;
    mConstantMinimumHeight=orig.mConstantMinimumHeight;
    mOpacity=orig.mOpacity;
    mHaveStateful=orig.mHaveStateful;
    mStateful=orig.mStateful;
    mDither=orig.mDither;
    mEnterFadeDuration=orig.mEnterFadeDuration;
    mExitFadeDuration=orig.mExitFadeDuration;
  }
 else {
    mDrawables=new Drawable[10];
    mNumChildren=0;
    mCheckedConstantState=mCanConstantState=false;
  }
}

Fixed version (ground truth):
DrawableContainerState(DrawableContainerState orig,DrawableContainer owner,Resources res){
  mOwner=owner;
  if (orig != null) {
    mChangingConfigurations=orig.mChangingConfigurations;
    mChildrenChangingConfigurations=orig.mChildrenChangingConfigurations;
    final Drawable[] origDr=orig.mDrawables;
    mDrawables=new Drawable[origDr.length];
    mNumChildren=orig.mNumChildren;
    final int N=mNumChildren;
    for (int i=0; i < N; i++) {
      if (res != null) {
        mDrawables[i]=origDr[i].getConstantState().newDrawable(res);
      }
 else {
        mDrawables[i]=origDr[i].getConstantState().newDrawable();
      }
      mDrawables[i].setCallback(owner);
      mDrawables[i].setLayoutDirection(origDr[i].getLayoutDirection());
    }
    mCheckedConstantState=mCanConstantState=true;
    mVariablePadding=orig.mVariablePadding;
    if (orig.mConstantPadding != null) {
      mConstantPadding=new Rect(orig.mConstantPadding);
    }
    mConstantSize=orig.mConstantSize;
    mComputedConstantSize=orig.mComputedConstantSize;
    mConstantWidth=orig.mConstantWidth;
    mConstantHeight=orig.mConstantHeight;
    mConstantMinimumWidth=orig.mConstantMinimumWidth;
    mConstantMinimumHeight=orig.mConstantMinimumHeight;
    mOpacity=orig.mOpacity;
    mHaveStateful=orig.mHaveStateful;
    mStateful=orig.mStateful;
    mDither=orig.mDither;
    mEnterFadeDuration=orig.mEnterFadeDuration;
    mExitFadeDuration=orig.mExitFadeDuration;
  }
 else {
    mDrawables=new Drawable[10];
    mNumChildren=0;
    mCheckedConstantState=mCanConstantState=false;
  }
}
Program: 2014
Project: 2014
Buggy source:
InsetState(InsetState orig,InsetDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mInsetLeft=orig.mInsetLeft;
    mInsetTop=orig.mInsetTop;
    mInsetRight=orig.mInsetRight;
    mInsetBottom=orig.mInsetBottom;
    mCheckedConstantState=mCanConstantState=true;
  }
}

Fixed version (ground truth):
InsetState(InsetState orig,InsetDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());
    mInsetLeft=orig.mInsetLeft;
    mInsetTop=orig.mInsetTop;
    mInsetRight=orig.mInsetRight;
    mInsetBottom=orig.mInsetBottom;
    mCheckedConstantState=mCanConstantState=true;
  }
}
Program: 2015
Project: 2015
Buggy source:
/** 
 * @hide 
 */
@Override public void setLayoutDirection(int layoutDirection){
  if (getLayoutDirection() != layoutDirection) {
    final ChildDrawable[] array=mLayerState.mChildren;
    final int N=mLayerState.mNum;
    for (int i=0; i < N; i++) {
      array[i].mDrawable.setLayoutDirection(layoutDirection);
    }
  }
  super.setLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
/** 
 * @hide 
 */
@Override public void setLayoutDirection(int layoutDirection){
  final ChildDrawable[] array=mLayerState.mChildren;
  final int N=mLayerState.mNum;
  for (int i=0; i < N; i++) {
    array[i].mDrawable.setLayoutDirection(layoutDirection);
  }
  super.setLayoutDirection(layoutDirection);
}
Program: 2016
Project: 2016
Buggy source:
LayerState(LayerState orig,LayerDrawable owner,Resources res){
  if (orig != null) {
    final ChildDrawable[] origChildDrawable=orig.mChildren;
    final int N=orig.mNum;
    mNum=N;
    mChildren=new ChildDrawable[N];
    mChangingConfigurations=orig.mChangingConfigurations;
    mChildrenChangingConfigurations=orig.mChildrenChangingConfigurations;
    for (int i=0; i < N; i++) {
      final ChildDrawable r=mChildren[i]=new ChildDrawable();
      final ChildDrawable or=origChildDrawable[i];
      if (res != null) {
        r.mDrawable=or.mDrawable.getConstantState().newDrawable(res);
      }
 else {
        r.mDrawable=or.mDrawable.getConstantState().newDrawable();
      }
      r.mDrawable.setCallback(owner);
      r.mInsetL=or.mInsetL;
      r.mInsetT=or.mInsetT;
      r.mInsetR=or.mInsetR;
      r.mInsetB=or.mInsetB;
      r.mId=or.mId;
    }
    mHaveOpacity=orig.mHaveOpacity;
    mOpacity=orig.mOpacity;
    mHaveStateful=orig.mHaveStateful;
    mStateful=orig.mStateful;
    mCheckedConstantState=mCanConstantState=true;
  }
 else {
    mNum=0;
    mChildren=null;
  }
}

Fixed version (ground truth):
LayerState(LayerState orig,LayerDrawable owner,Resources res){
  if (orig != null) {
    final ChildDrawable[] origChildDrawable=orig.mChildren;
    final int N=orig.mNum;
    mNum=N;
    mChildren=new ChildDrawable[N];
    mChangingConfigurations=orig.mChangingConfigurations;
    mChildrenChangingConfigurations=orig.mChildrenChangingConfigurations;
    for (int i=0; i < N; i++) {
      final ChildDrawable r=mChildren[i]=new ChildDrawable();
      final ChildDrawable or=origChildDrawable[i];
      if (res != null) {
        r.mDrawable=or.mDrawable.getConstantState().newDrawable(res);
      }
 else {
        r.mDrawable=or.mDrawable.getConstantState().newDrawable();
      }
      r.mDrawable.setCallback(owner);
      r.mDrawable.setLayoutDirection(or.mDrawable.getLayoutDirection());
      r.mInsetL=or.mInsetL;
      r.mInsetT=or.mInsetT;
      r.mInsetR=or.mInsetR;
      r.mInsetB=or.mInsetB;
      r.mId=or.mId;
    }
    mHaveOpacity=orig.mHaveOpacity;
    mOpacity=orig.mOpacity;
    mHaveStateful=orig.mHaveStateful;
    mStateful=orig.mStateful;
    mCheckedConstantState=mCanConstantState=true;
  }
 else {
    mNum=0;
    mChildren=null;
  }
}
Program: 2017
Project: 2017
Buggy source:
public RotateState(RotateState source,RotateDrawable owner,Resources res){
  if (source != null) {
    if (res != null) {
      mDrawable=source.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=source.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mPivotXRel=source.mPivotXRel;
    mPivotX=source.mPivotX;
    mPivotYRel=source.mPivotYRel;
    mPivotY=source.mPivotY;
    mFromDegrees=mCurrentDegrees=source.mFromDegrees;
    mToDegrees=source.mToDegrees;
    mCanConstantState=mCheckedConstantState=true;
  }
}

Fixed version (ground truth):
public RotateState(RotateState source,RotateDrawable owner,Resources res){
  if (source != null) {
    if (res != null) {
      mDrawable=source.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=source.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(source.mDrawable.getLayoutDirection());
    mPivotXRel=source.mPivotXRel;
    mPivotX=source.mPivotX;
    mPivotYRel=source.mPivotYRel;
    mPivotY=source.mPivotY;
    mFromDegrees=mCurrentDegrees=source.mFromDegrees;
    mToDegrees=source.mToDegrees;
    mCanConstantState=mCheckedConstantState=true;
  }
}
Program: 2018
Project: 2018
Buggy source:
ScaleState(ScaleState orig,ScaleDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mScaleWidth=orig.mScaleWidth;
    mScaleHeight=orig.mScaleHeight;
    mGravity=orig.mGravity;
    mUseIntrinsicSizeAsMin=orig.mUseIntrinsicSizeAsMin;
    mCheckedConstantState=mCanConstantState=true;
  }
}

Fixed version (ground truth):
ScaleState(ScaleState orig,ScaleDrawable owner,Resources res){
  if (orig != null) {
    if (res != null) {
      mDrawable=orig.mDrawable.getConstantState().newDrawable(res);
    }
 else {
      mDrawable=orig.mDrawable.getConstantState().newDrawable();
    }
    mDrawable.setCallback(owner);
    mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());
    mScaleWidth=orig.mScaleWidth;
    mScaleHeight=orig.mScaleHeight;
    mGravity=orig.mGravity;
    mUseIntrinsicSizeAsMin=orig.mUseIntrinsicSizeAsMin;
    mCheckedConstantState=mCanConstantState=true;
  }
}
Program: 2024
Project: 2024
Buggy source:
public void init(UserInfo user,KeyguardMultiUserSelectorView userSelector){
  mUserInfo=user;
  mUserSelector=userSelector;
  mUserImage=(ImageView)findViewById(R.id.keyguard_user_avatar);
  mUserName=(TextView)findViewById(R.id.keyguard_user_name);
  Bitmap icon=mUserManager.getUserIcon(user.id);
  if (icon == null) {
    if (DEBUG)     Log.w(TAG,"String_Node_Str" + user.id);
    icon=BitmapFactory.decodeResource(mContext.getResources(),R.drawable.ic_contact_picture);
  }
  mFramed=(KeyguardCircleFramedDrawable)KeyguardViewMediator.getAvatarCache().get(user.id);
  if (mFramed == null || !mFramed.verifyParams(mIconSize,mFrameColor,mStroke,mFrameShadowColor,mShadowRadius,mHighlightColor)) {
    Bitmap icon=null;
    try {
      icon=BitmapFactory.decodeFile(rewriteIconPath(user.iconPath));
    }
 catch (    Exception e) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str" + user.iconPath,e);
    }
    if (icon == null) {
      icon=BitmapFactory.decodeResource(mContext.getResources(),com.android.internal.R.drawable.ic_contact_picture);
    }
    mFramed=new KeyguardCircleFramedDrawable(icon,(int)mIconSize,mFrameColor,mStroke,mFrameShadowColor,mShadowRadius,mHighlightColor);
    KeyguardViewMediator.getAvatarCache().put(user.id,mFramed);
  }
  mFramed.reset();
  mUserImage.setImageDrawable(mFramed);
  mUserName.setText(mUserInfo.name);
  setOnClickListener(mUserSelector);
  mInit=false;
}

Fixed version (ground truth):
public void init(UserInfo user,KeyguardMultiUserSelectorView userSelector){
  mUserInfo=user;
  mUserSelector=userSelector;
  mUserImage=(ImageView)findViewById(R.id.keyguard_user_avatar);
  mUserName=(TextView)findViewById(R.id.keyguard_user_name);
  mFramed=(KeyguardCircleFramedDrawable)KeyguardViewMediator.getAvatarCache().get(user.id);
  if (mFramed == null || !mFramed.verifyParams(mIconSize,mFrameColor,mStroke,mFrameShadowColor,mShadowRadius,mHighlightColor)) {
    Bitmap icon=null;
    try {
      icon=BitmapFactory.decodeFile(rewriteIconPath(user.iconPath));
    }
 catch (    Exception e) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str" + user.iconPath,e);
    }
    if (icon == null) {
      icon=BitmapFactory.decodeResource(mContext.getResources(),com.android.internal.R.drawable.ic_contact_picture);
    }
    mFramed=new KeyguardCircleFramedDrawable(icon,(int)mIconSize,mFrameColor,mStroke,mFrameShadowColor,mShadowRadius,mHighlightColor);
    KeyguardViewMediator.getAvatarCache().put(user.id,mFramed);
  }
  mFramed.reset();
  mUserImage.setImageDrawable(mFramed);
  mUserName.setText(mUserInfo.name);
  setOnClickListener(mUserSelector);
  mInit=false;
}
Program: 2029
Project: 2029
Buggy source:
/** 
 * Replace existing canvas while ensuring that the swap has occurred before the previous native canvas is unreferenced.
 */
private void safeCanvasSwap(int nativeCanvas){
  final int oldCanvas=mNativeCanvas;
  mNativeCanvas=nativeCanvas;
  mFinalizer.mNativeCanvas=nativeCanvas;
  copyNativeCanvasState(oldCanvas,mNativeCanvas);
  finalizer(oldCanvas);
}

Fixed version (ground truth):
/** 
 * Replace existing canvas while ensuring that the swap has occurred before the previous native canvas is unreferenced.
 */
private void safeCanvasSwap(int nativeCanvas,boolean copyState){
  final int oldCanvas=mNativeCanvas;
  mNativeCanvas=nativeCanvas;
  mFinalizer.mNativeCanvas=nativeCanvas;
  if (copyState) {
    copyNativeCanvasState(oldCanvas,mNativeCanvas);
  }
  finalizer(oldCanvas);
}
Program: 2030
Project: 2030
Buggy source:
/** 
 * Specify a bitmap for the canvas to draw into. As a side-effect, the canvas' target density is updated to match that of the bitmap while all other state such as the layers, filters, matrix, and clip are reset.
 * @param bitmap Specifies a mutable bitmap for the canvas to draw into.
 * @see #setDensity(int)
 * @see #getDensity()
 */
public void setBitmap(Bitmap bitmap){
  if (isHardwareAccelerated()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (bitmap == null) {
    safeCanvasSwap(initRaster(0));
    mDensity=Bitmap.DENSITY_NONE;
  }
 else {
    if (!bitmap.isMutable()) {
      throw new IllegalStateException();
    }
    throwIfRecycled(bitmap);
    safeCanvasSwap(initRaster(bitmap.ni()));
    mDensity=bitmap.mDensity;
  }
  mBitmap=bitmap;
}

Fixed version (ground truth):
/** 
 * Specify a bitmap for the canvas to draw into. All canvas state such as  layers, filters, and the save/restore stack are reset with the exception of the current matrix and clip stack. Additionally, as a side-effect the canvas' target density is updated to match that of the bitmap.
 * @param bitmap Specifies a mutable bitmap for the canvas to draw into.
 * @see #setDensity(int)
 * @see #getDensity()
 */
public void setBitmap(Bitmap bitmap){
  if (isHardwareAccelerated()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (bitmap == null) {
    safeCanvasSwap(initRaster(0),false);
    mDensity=Bitmap.DENSITY_NONE;
  }
 else {
    if (!bitmap.isMutable()) {
      throw new IllegalStateException();
    }
    throwIfRecycled(bitmap);
    safeCanvasSwap(initRaster(bitmap.ni()),true);
    mDensity=bitmap.mDensity;
  }
  mBitmap=bitmap;
}
Program: 2033
Project: 2033
Buggy source:
/** 
 * Replace existing canvas while ensuring that the swap has occurred before the previous native canvas is unreferenced.
 */
private void safeCanvasSwap(int nativeCanvas){
  final int oldCanvas=mNativeCanvas;
  mNativeCanvas=nativeCanvas;
  mFinalizer.mNativeCanvas=nativeCanvas;
  copyNativeCanvasState(oldCanvas,mNativeCanvas);
  finalizer(oldCanvas);
}

Fixed version (ground truth):
/** 
 * Replace existing canvas while ensuring that the swap has occurred before the previous native canvas is unreferenced.
 */
private void safeCanvasSwap(int nativeCanvas,boolean copyState){
  final int oldCanvas=mNativeCanvas;
  mNativeCanvas=nativeCanvas;
  mFinalizer.mNativeCanvas=nativeCanvas;
  if (copyState) {
    copyNativeCanvasState(oldCanvas,mNativeCanvas);
  }
  finalizer(oldCanvas);
}
Program: 2034
Project: 2034
Buggy source:
/** 
 * Specify a bitmap for the canvas to draw into. As a side-effect, the canvas' target density is updated to match that of the bitmap while all other state such as the layers, filters, matrix, and clip are reset.
 * @param bitmap Specifies a mutable bitmap for the canvas to draw into.
 * @see #setDensity(int)
 * @see #getDensity()
 */
public void setBitmap(Bitmap bitmap){
  if (isHardwareAccelerated()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (bitmap == null) {
    safeCanvasSwap(initRaster(0));
    mDensity=Bitmap.DENSITY_NONE;
  }
 else {
    if (!bitmap.isMutable()) {
      throw new IllegalStateException();
    }
    throwIfRecycled(bitmap);
    safeCanvasSwap(initRaster(bitmap.ni()));
    mDensity=bitmap.mDensity;
  }
  mBitmap=bitmap;
}

Fixed version (ground truth):
/** 
 * Specify a bitmap for the canvas to draw into. All canvas state such as  layers, filters, and the save/restore stack are reset with the exception of the current matrix and clip stack. Additionally, as a side-effect the canvas' target density is updated to match that of the bitmap.
 * @param bitmap Specifies a mutable bitmap for the canvas to draw into.
 * @see #setDensity(int)
 * @see #getDensity()
 */
public void setBitmap(Bitmap bitmap){
  if (isHardwareAccelerated()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (bitmap == null) {
    safeCanvasSwap(initRaster(0),false);
    mDensity=Bitmap.DENSITY_NONE;
  }
 else {
    if (!bitmap.isMutable()) {
      throw new IllegalStateException();
    }
    throwIfRecycled(bitmap);
    safeCanvasSwap(initRaster(bitmap.ni()),true);
    mDensity=bitmap.mDensity;
  }
  mBitmap=bitmap;
}
Program: 2035
Project: 2035
Buggy source:
/** 
 * Replace existing canvas while ensuring that the swap has occurred before the previous native canvas is unreferenced.
 */
private void safeCanvasSwap(int nativeCanvas){
  final int oldCanvas=mNativeCanvas;
  mNativeCanvas=nativeCanvas;
  mFinalizer.mNativeCanvas=nativeCanvas;
  copyNativeCanvasState(oldCanvas,mNativeCanvas);
  finalizer(oldCanvas);
}

Fixed version (ground truth):
/** 
 * Replace existing canvas while ensuring that the swap has occurred before the previous native canvas is unreferenced.
 */
private void safeCanvasSwap(int nativeCanvas,boolean copyState){
  final int oldCanvas=mNativeCanvas;
  mNativeCanvas=nativeCanvas;
  mFinalizer.mNativeCanvas=nativeCanvas;
  if (copyState) {
    copyNativeCanvasState(oldCanvas,mNativeCanvas);
  }
  finalizer(oldCanvas);
}
Program: 2036
Project: 2036
Buggy source:
/** 
 * Specify a bitmap for the canvas to draw into. As a side-effect, the canvas' target density is updated to match that of the bitmap while all other state such as the layers, filters, matrix, and clip are reset.
 * @param bitmap Specifies a mutable bitmap for the canvas to draw into.
 * @see #setDensity(int)
 * @see #getDensity()
 */
public void setBitmap(Bitmap bitmap){
  if (isHardwareAccelerated()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (bitmap == null) {
    safeCanvasSwap(initRaster(0));
    mDensity=Bitmap.DENSITY_NONE;
  }
 else {
    if (!bitmap.isMutable()) {
      throw new IllegalStateException();
    }
    throwIfRecycled(bitmap);
    safeCanvasSwap(initRaster(bitmap.ni()));
    mDensity=bitmap.mDensity;
  }
  mBitmap=bitmap;
}

Fixed version (ground truth):
/** 
 * Specify a bitmap for the canvas to draw into. All canvas state such as  layers, filters, and the save/restore stack are reset with the exception of the current matrix and clip stack. Additionally, as a side-effect the canvas' target density is updated to match that of the bitmap.
 * @param bitmap Specifies a mutable bitmap for the canvas to draw into.
 * @see #setDensity(int)
 * @see #getDensity()
 */
public void setBitmap(Bitmap bitmap){
  if (isHardwareAccelerated()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (bitmap == null) {
    safeCanvasSwap(initRaster(0),false);
    mDensity=Bitmap.DENSITY_NONE;
  }
 else {
    if (!bitmap.isMutable()) {
      throw new IllegalStateException();
    }
    throwIfRecycled(bitmap);
    safeCanvasSwap(initRaster(bitmap.ni()),true);
    mDensity=bitmap.mDensity;
  }
  mBitmap=bitmap;
}
Program: 2039
Project: 2039
Buggy source:
private void animateInIconOfFirstTask(){
  if (mItemToAnimateInWhenWindowAnimationIsFinished != null && !mRecentTasksLoader.isFirstScreenful()) {
    int timeSinceWindowAnimation=(int)(System.currentTimeMillis() - mWindowAnimationStartTime);
    final int minStartDelay=125;
    final int startDelay=Math.max(0,Math.min(minStartDelay - timeSinceWindowAnimation,minStartDelay));
    final int duration=250;
    final ViewHolder holder=mItemToAnimateInWhenWindowAnimationIsFinished;
    final TimeInterpolator cubic=new DecelerateInterpolator(1.5f);
    FirstFrameAnimatorHelper.initializeDrawListener(holder.iconView);
    for (    View v : new View[]{holder.iconView,holder.labelView,holder.calloutLine}) {
      if (v != null) {
        ViewPropertyAnimator vpa=v.animate().translationX(0).translationY(0).alpha(1f).setStartDelay(startDelay).setDuration(duration).setInterpolator(cubic);
        FirstFrameAnimatorHelper h=new FirstFrameAnimatorHelper(vpa,v);
      }
    }
    mItemToAnimateInWhenWindowAnimationIsFinished=null;
    mAnimateIconOfFirstTask=false;
  }
}

Fixed version (ground truth):
private void animateInIconOfFirstTask(){
  if (mItemToAnimateInWhenWindowAnimationIsFinished != null && !mRecentTasksLoader.isFirstScreenful()) {
    int timeSinceWindowAnimation=(int)(System.currentTimeMillis() - mWindowAnimationStartTime);
    final int minStartDelay=150;
    final int startDelay=Math.max(0,Math.min(minStartDelay - timeSinceWindowAnimation,minStartDelay));
    final int duration=250;
    final ViewHolder holder=mItemToAnimateInWhenWindowAnimationIsFinished;
    final TimeInterpolator cubic=new DecelerateInterpolator(1.5f);
    FirstFrameAnimatorHelper.initializeDrawListener(holder.iconView);
    for (    View v : new View[]{holder.iconView,holder.labelView,holder.calloutLine}) {
      if (v != null) {
        ViewPropertyAnimator vpa=v.animate().translationX(0).translationY(0).alpha(1f).setStartDelay(startDelay).setDuration(duration).setInterpolator(cubic);
        FirstFrameAnimatorHelper h=new FirstFrameAnimatorHelper(vpa,v);
      }
    }
    mItemToAnimateInWhenWindowAnimationIsFinished=null;
    mAnimateIconOfFirstTask=false;
  }
}
Program: 2041
Project: 2041
Buggy source:
private void animateInIconOfFirstTask(){
  if (mItemToAnimateInWhenWindowAnimationIsFinished != null && !mRecentTasksLoader.isFirstScreenful()) {
    int timeSinceWindowAnimation=(int)(System.currentTimeMillis() - mWindowAnimationStartTime);
    final int minStartDelay=125;
    final int startDelay=Math.max(0,Math.min(minStartDelay - timeSinceWindowAnimation,minStartDelay));
    final int duration=250;
    final ViewHolder holder=mItemToAnimateInWhenWindowAnimationIsFinished;
    final TimeInterpolator cubic=new DecelerateInterpolator(1.5f);
    FirstFrameAnimatorHelper.initializeDrawListener(holder.iconView);
    for (    View v : new View[]{holder.iconView,holder.labelView,holder.calloutLine}) {
      if (v != null) {
        ViewPropertyAnimator vpa=v.animate().translationX(0).translationY(0).alpha(1f).setStartDelay(startDelay).setDuration(duration).setInterpolator(cubic);
        FirstFrameAnimatorHelper h=new FirstFrameAnimatorHelper(vpa,v);
      }
    }
    mItemToAnimateInWhenWindowAnimationIsFinished=null;
    mAnimateIconOfFirstTask=false;
  }
}

Fixed version (ground truth):
private void animateInIconOfFirstTask(){
  if (mItemToAnimateInWhenWindowAnimationIsFinished != null && !mRecentTasksLoader.isFirstScreenful()) {
    int timeSinceWindowAnimation=(int)(System.currentTimeMillis() - mWindowAnimationStartTime);
    final int minStartDelay=150;
    final int startDelay=Math.max(0,Math.min(minStartDelay - timeSinceWindowAnimation,minStartDelay));
    final int duration=250;
    final ViewHolder holder=mItemToAnimateInWhenWindowAnimationIsFinished;
    final TimeInterpolator cubic=new DecelerateInterpolator(1.5f);
    FirstFrameAnimatorHelper.initializeDrawListener(holder.iconView);
    for (    View v : new View[]{holder.iconView,holder.labelView,holder.calloutLine}) {
      if (v != null) {
        ViewPropertyAnimator vpa=v.animate().translationX(0).translationY(0).alpha(1f).setStartDelay(startDelay).setDuration(duration).setInterpolator(cubic);
        FirstFrameAnimatorHelper h=new FirstFrameAnimatorHelper(vpa,v);
      }
    }
    mItemToAnimateInWhenWindowAnimationIsFinished=null;
    mAnimateIconOfFirstTask=false;
  }
}
Program: 2043
Project: 2043
Buggy source:
private void animateInIconOfFirstTask(){
  if (mItemToAnimateInWhenWindowAnimationIsFinished != null && !mRecentTasksLoader.isFirstScreenful()) {
    int timeSinceWindowAnimation=(int)(System.currentTimeMillis() - mWindowAnimationStartTime);
    final int minStartDelay=125;
    final int startDelay=Math.max(0,Math.min(minStartDelay - timeSinceWindowAnimation,minStartDelay));
    final int duration=250;
    final ViewHolder holder=mItemToAnimateInWhenWindowAnimationIsFinished;
    final TimeInterpolator cubic=new DecelerateInterpolator(1.5f);
    FirstFrameAnimatorHelper.initializeDrawListener(holder.iconView);
    for (    View v : new View[]{holder.iconView,holder.labelView,holder.calloutLine}) {
      if (v != null) {
        ViewPropertyAnimator vpa=v.animate().translationX(0).translationY(0).alpha(1f).setStartDelay(startDelay).setDuration(duration).setInterpolator(cubic);
        FirstFrameAnimatorHelper h=new FirstFrameAnimatorHelper(vpa,v);
      }
    }
    mItemToAnimateInWhenWindowAnimationIsFinished=null;
    mAnimateIconOfFirstTask=false;
  }
}

Fixed version (ground truth):
private void animateInIconOfFirstTask(){
  if (mItemToAnimateInWhenWindowAnimationIsFinished != null && !mRecentTasksLoader.isFirstScreenful()) {
    int timeSinceWindowAnimation=(int)(System.currentTimeMillis() - mWindowAnimationStartTime);
    final int minStartDelay=150;
    final int startDelay=Math.max(0,Math.min(minStartDelay - timeSinceWindowAnimation,minStartDelay));
    final int duration=250;
    final ViewHolder holder=mItemToAnimateInWhenWindowAnimationIsFinished;
    final TimeInterpolator cubic=new DecelerateInterpolator(1.5f);
    FirstFrameAnimatorHelper.initializeDrawListener(holder.iconView);
    for (    View v : new View[]{holder.iconView,holder.labelView,holder.calloutLine}) {
      if (v != null) {
        ViewPropertyAnimator vpa=v.animate().translationX(0).translationY(0).alpha(1f).setStartDelay(startDelay).setDuration(duration).setInterpolator(cubic);
        FirstFrameAnimatorHelper h=new FirstFrameAnimatorHelper(vpa,v);
      }
    }
    mItemToAnimateInWhenWindowAnimationIsFinished=null;
    mAnimateIconOfFirstTask=false;
  }
}
Program: 2044
Project: 2044
Buggy source:
public int compare(View first,View second){
  if (first == second) {
    return 0;
  }
  getRect(first,mFirstRect);
  getRect(second,mSecondRect);
  if (mFirstRect.top < mSecondRect.top) {
    return -1;
  }
 else   if (mFirstRect.top > mSecondRect.top) {
    return 1;
  }
 else   if (mFirstRect.left < mSecondRect.left) {
    return -1;
  }
 else   if (mFirstRect.left > mSecondRect.left) {
    return 1;
  }
 else   if (mFirstRect.bottom < mSecondRect.bottom) {
    return -1;
  }
 else   if (mFirstRect.bottom > mSecondRect.bottom) {
    return 1;
  }
 else   if (mFirstRect.right < mSecondRect.right) {
    return -1;
  }
 else   if (mFirstRect.right > mSecondRect.right) {
    return 1;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public int compare(View first,View second){
  if (first == second) {
    return 0;
  }
  getRect(first,mFirstRect);
  getRect(second,mSecondRect);
  if (mFirstRect.top < mSecondRect.top) {
    return -1;
  }
 else   if (mFirstRect.top > mSecondRect.top) {
    return 1;
  }
 else   if (mFirstRect.left < mSecondRect.left) {
    return mIsLayoutRtl ? 1 : -1;
  }
 else   if (mFirstRect.left > mSecondRect.left) {
    return mIsLayoutRtl ? -1 : 1;
  }
 else   if (mFirstRect.bottom < mSecondRect.bottom) {
    return -1;
  }
 else   if (mFirstRect.bottom > mSecondRect.bottom) {
    return 1;
  }
 else   if (mFirstRect.right < mSecondRect.right) {
    return mIsLayoutRtl ? 1 : -1;
  }
 else   if (mFirstRect.right > mSecondRect.right) {
    return mIsLayoutRtl ? -1 : 1;
  }
 else {
    return 0;
  }
}
Program: 2045
Project: 2045
Buggy source:
private View findNextFocusInRelativeDirection(ArrayList<View> focusables,ViewGroup root,View focused,Rect focusedRect,int direction){
  try {
    mSequentialFocusComparator.setRoot(root);
    Collections.sort(focusables,mSequentialFocusComparator);
  }
  finally {
    mSequentialFocusComparator.recycle();
  }
  final int count=focusables.size();
switch (direction) {
case View.FOCUS_FORWARD:
    return getForwardFocusable(root,focused,focusables,count);
case View.FOCUS_BACKWARD:
  return getBackwardFocusable(root,focused,focusables,count);
}
return focusables.get(count - 1);
}

Fixed version (ground truth):
private View findNextFocusInRelativeDirection(ArrayList<View> focusables,ViewGroup root,View focused,Rect focusedRect,int direction){
  try {
    mSequentialFocusComparator.setRoot(root);
    mSequentialFocusComparator.setIsLayoutRtl(root.isLayoutRtl());
    Collections.sort(focusables,mSequentialFocusComparator);
  }
  finally {
    mSequentialFocusComparator.recycle();
  }
  final int count=focusables.size();
switch (direction) {
case View.FOCUS_FORWARD:
    return getNextFocusable(focused,focusables,count);
case View.FOCUS_BACKWARD:
  return getPreviousFocusable(focused,focusables,count);
}
return focusables.get(count - 1);
}
Program: 2047
Project: 2047
Buggy source:
public int compare(View first,View second){
  if (first == second) {
    return 0;
  }
  getRect(first,mFirstRect);
  getRect(second,mSecondRect);
  if (mFirstRect.top < mSecondRect.top) {
    return -1;
  }
 else   if (mFirstRect.top > mSecondRect.top) {
    return 1;
  }
 else   if (mFirstRect.left < mSecondRect.left) {
    return -1;
  }
 else   if (mFirstRect.left > mSecondRect.left) {
    return 1;
  }
 else   if (mFirstRect.bottom < mSecondRect.bottom) {
    return -1;
  }
 else   if (mFirstRect.bottom > mSecondRect.bottom) {
    return 1;
  }
 else   if (mFirstRect.right < mSecondRect.right) {
    return -1;
  }
 else   if (mFirstRect.right > mSecondRect.right) {
    return 1;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public int compare(View first,View second){
  if (first == second) {
    return 0;
  }
  getRect(first,mFirstRect);
  getRect(second,mSecondRect);
  if (mFirstRect.top < mSecondRect.top) {
    return -1;
  }
 else   if (mFirstRect.top > mSecondRect.top) {
    return 1;
  }
 else   if (mFirstRect.left < mSecondRect.left) {
    return mIsLayoutRtl ? 1 : -1;
  }
 else   if (mFirstRect.left > mSecondRect.left) {
    return mIsLayoutRtl ? -1 : 1;
  }
 else   if (mFirstRect.bottom < mSecondRect.bottom) {
    return -1;
  }
 else   if (mFirstRect.bottom > mSecondRect.bottom) {
    return 1;
  }
 else   if (mFirstRect.right < mSecondRect.right) {
    return mIsLayoutRtl ? 1 : -1;
  }
 else   if (mFirstRect.right > mSecondRect.right) {
    return mIsLayoutRtl ? -1 : 1;
  }
 else {
    return 0;
  }
}