nus-yam/ex-repair huggingface dataset:
Program: 192124
Project: 192124
Buggy source:
@Override protected void onDraw(Canvas canvas){
  if (mInvisible) {
    return;
  }
  int viewWidth=mTaskViewRect.width();
  int viewHeight=mTaskViewRect.height();
  if (mBitmapShader != null) {
    int thumbnailWidth=(int)(mThumbnailRect.width() * mThumbnailScale);
    int thumbnailHeight=(int)(mThumbnailRect.height() * mThumbnailScale);
    if (thumbnailWidth >= viewWidth && thumbnailHeight >= viewHeight) {
      canvas.drawRoundRect(0,0,viewWidth,viewHeight,mCornerRadius,mCornerRadius,mDrawPaint);
    }
 else {
      int count=canvas.save();
      canvas.clipRect(0,0,thumbnailWidth,thumbnailHeight,Region.Op.REPLACE);
      canvas.drawRoundRect(0,0,thumbnailWidth + (thumbnailWidth < viewWidth ? mCornerRadius : 0),thumbnailHeight + (thumbnailHeight < viewHeight ? mCornerRadius : 0),mCornerRadius,mCornerRadius,mDrawPaint);
      if (thumbnailWidth < viewWidth) {
        canvas.clipRect(thumbnailWidth,0,viewWidth,viewHeight,Region.Op.REPLACE);
        canvas.drawRoundRect(Math.max(0,thumbnailWidth - mCornerRadius),0,viewWidth,viewHeight,mCornerRadius,mCornerRadius,mBgFillPaint);
      }
      if (thumbnailWidth > 0 && thumbnailHeight < viewHeight) {
        canvas.clipRect(0,thumbnailHeight,viewWidth,viewHeight,Region.Op.REPLACE);
        canvas.drawRoundRect(0,Math.max(0,thumbnailHeight - mCornerRadius),viewWidth,viewHeight,mCornerRadius,mCornerRadius,mBgFillPaint);
      }
      canvas.restoreToCount(count);
    }
  }
 else {
    canvas.drawRoundRect(0,0,viewWidth,viewHeight,mCornerRadius,mCornerRadius,mBgFillPaint);
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  if (mInvisible) {
    return;
  }
  int viewWidth=mTaskViewRect.width();
  int viewHeight=mTaskViewRect.height();
  int thumbnailWidth=Math.min(viewWidth,(int)(mThumbnailRect.width() * mThumbnailScale));
  int thumbnailHeight=Math.min(viewHeight,(int)(mThumbnailRect.height() * mThumbnailScale));
  if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) {
    if (thumbnailWidth < viewWidth) {
      canvas.drawRoundRect(Math.max(0,thumbnailWidth - mCornerRadius),0,viewWidth,viewHeight,mCornerRadius,mCornerRadius,mBgFillPaint);
    }
    if (thumbnailHeight < viewHeight) {
      canvas.drawRoundRect(0,Math.max(0,thumbnailHeight - mCornerRadius),viewWidth,viewHeight,mCornerRadius,mCornerRadius,mBgFillPaint);
    }
    canvas.drawRoundRect(0,0,thumbnailWidth,thumbnailHeight,mCornerRadius,mCornerRadius,mDrawPaint);
  }
 else {
    canvas.drawRoundRect(0,0,viewWidth,viewHeight,mCornerRadius,mCornerRadius,mBgFillPaint);
  }
}
Program: 192125
Project: 192125
Buggy source:
private void writeCompactedLongArray(Parcel out,long[] array,int num){
  for (int i=0; i < num; i++) {
    long val=array[i];
    if (val < 0) {
      Slog.w(TAG,"String_Node_Str" + val);
      val=0;
    }
    if (val <= Integer.MAX_VALUE) {
      out.writeInt((int)val);
    }
 else {
      int top=~((int)((val >> 32) & 0x7fffffff));
      int bottom=(int)(val & 0xfffffff);
      out.writeInt(top);
      out.writeInt(bottom);
    }
  }
}

Fixed version (ground truth):
private void writeCompactedLongArray(Parcel out,long[] array,int num){
  for (int i=0; i < num; i++) {
    long val=array[i];
    if (val < 0) {
      Slog.w(TAG,"String_Node_Str" + val);
      val=0;
    }
    if (val <= Integer.MAX_VALUE) {
      out.writeInt((int)val);
    }
 else {
      int top=~((int)((val >> 32) & 0x7fffffff));
      int bottom=(int)(val & 0x0ffffffffL);
      out.writeInt(top);
      out.writeInt(bottom);
    }
  }
}
Program: 192126
Project: 192126
Buggy source:
/** 
 * Allocates data in the buffer, and stores that key in the mapping for this table.
 * @param id    The id of the item (will be used in making the key)
 * @param count The number of bytes to allocate.  Must be less thanSparseMappingTable.ARRAY_SIZE.
 * @return The 'key' for this data value, which contains both the id itselfand the location in the long arrays that the data is actually stored but should be considered opaque to the caller.
 */
public int getOrAddKey(byte id,int count){
  if (mSequence == UNINITIALIZED_SEQUENCE) {
    mSequence=mParent.mSequence;
  }
  assertConsistency();
  final int idx=binarySearch(id);
  if (idx >= 0) {
    return mTable[idx];
  }
 else {
    final ArrayList<long[]> list=mParent.mLongs;
    int whichArray=list.size() - 1;
    long[] array=list.get(whichArray);
    if (mParent.mNextIndex + count > array.length) {
      array=new long[ARRAY_SIZE];
      list.add(array);
      whichArray++;
      mParent.mNextIndex=0;
    }
    final int key=(whichArray << ARRAY_SHIFT) | (mParent.mNextIndex << INDEX_SHIFT) | (((int)id) << ID_SHIFT);
    mParent.mNextIndex+=count;
    mTable=GrowingArrayUtils.insert(mTable != null ? mTable : EmptyArray.INT,mSize,~idx,key);
    mSize++;
    return key;
  }
}

Fixed version (ground truth):
/** 
 * Allocates data in the buffer, and stores that key in the mapping for this table.
 * @param id    The id of the item (will be used in making the key)
 * @param count The number of bytes to allocate.  Must be less thanSparseMappingTable.ARRAY_SIZE.
 * @return The 'key' for this data value, which contains both the id itselfand the location in the long arrays that the data is actually stored but should be considered opaque to the caller.
 */
public int getOrAddKey(byte id,int count){
  assertConsistency();
  final int idx=binarySearch(id);
  if (idx >= 0) {
    return mTable[idx];
  }
 else {
    final ArrayList<long[]> list=mParent.mLongs;
    int whichArray=list.size() - 1;
    long[] array=list.get(whichArray);
    if (mParent.mNextIndex + count > array.length) {
      array=new long[ARRAY_SIZE];
      list.add(array);
      whichArray++;
      mParent.mNextIndex=0;
    }
    final int key=(whichArray << ARRAY_SHIFT) | (mParent.mNextIndex << INDEX_SHIFT) | (((int)id) << ID_SHIFT);
    mParent.mNextIndex+=count;
    mTable=GrowingArrayUtils.insert(mTable != null ? mTable : EmptyArray.INT,mSize,~idx,key);
    mSize++;
    return key;
  }
}
Program: 192127
Project: 192127
Buggy source:
/** 
 * Clear out the table, and reset the sequence numbers so future writes without allocations will assert.
 */
public void resetTable(){
  mTable=null;
  mSize=0;
  mSequence=UNINITIALIZED_SEQUENCE;
}

Fixed version (ground truth):
/** 
 * Clear out the table, and reset the sequence numbers so future writes without allocations will assert.
 */
public void resetTable(){
  mTable=null;
  mSize=0;
  mSequence=mParent.mSequence;
}
Program: 192128
Project: 192128
Buggy source:
public String dumpInternalState(){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append(mSequence);
  sb.append("String_Node_Str");
  sb.append(mParent.mSequence);
  sb.append("String_Node_Str");
  sb.append(mParent.mLongs.size());
  sb.append("String_Node_Str");
  sb.append(mSize);
  sb.append("String_Node_Str");
  if (mTable == null) {
    sb.append("String_Node_Str");
  }
 else {
    final int N=mTable.length;
    sb.append('[');
    for (int i=0; i < N; i++) {
      final int key=mTable[i];
      sb.append("String_Node_Str");
      sb.append(Integer.toHexString((key >> ID_SHIFT) & ID_MASK));
      sb.append("String_Node_Str");
      sb.append(Integer.toHexString((key >> ARRAY_SHIFT) & ARRAY_MASK));
      sb.append("String_Node_Str");
      sb.append(Integer.toHexString((key >> INDEX_SHIFT) & INDEX_MASK));
      if (i != N - 1) {
        sb.append("String_Node_Str");
      }
    }
    sb.append(']');
  }
  sb.append("String_Node_Str");
  sb.append(getClass().getName());
  sb.append('}');
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Return a string for debugging.
 */
public String dumpInternalState(boolean includeData){
  final StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append(mSequence);
  sb.append("String_Node_Str");
  sb.append(mNextIndex);
  sb.append("String_Node_Str");
  final int N=mLongs.size();
  sb.append(N);
  sb.append("String_Node_Str");
  if (includeData) {
    for (int i=0; i < N; i++) {
      final long[] array=mLongs.get(i);
      for (int j=0; j < array.length; j++) {
        if (i == N - 1 && j == mNextIndex) {
          break;
        }
        sb.append(String.format("String_Node_Str",i,j,array[j],array[j]));
      }
    }
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 192129
Project: 192129
Buggy source:
/** 
 * Write the long array to the parcel in a compacted form.  Does not allow negative values in the array.
 */
private static void writeCompactedLongArray(Parcel out,long[] array,int num){
  for (int i=0; i < num; i++) {
    long val=array[i];
    if (val < 0) {
      Slog.w(TAG,"String_Node_Str" + val);
      val=0;
    }
    if (val <= Integer.MAX_VALUE) {
      out.writeInt((int)val);
    }
 else {
      int top=~((int)((val >> 32) & 0x7fffffff));
      int bottom=(int)(val & 0xfffffff);
      out.writeInt(top);
      out.writeInt(bottom);
    }
  }
}

Fixed version (ground truth):
/** 
 * Write the long array to the parcel in a compacted form.  Does not allow negative values in the array.
 */
private static void writeCompactedLongArray(Parcel out,long[] array,int num){
  for (int i=0; i < num; i++) {
    long val=array[i];
    if (val < 0) {
      Slog.w(TAG,"String_Node_Str" + val);
      val=0;
    }
    if (val <= Integer.MAX_VALUE) {
      out.writeInt((int)val);
    }
 else {
      int top=~((int)((val >> 32) & 0x7fffffff));
      int bottom=(int)(val & 0x0ffffffffL);
      out.writeInt(top);
      out.writeInt(bottom);
    }
  }
}
Program: 192130
Project: 192130
Buggy source:
/** 
 * Throw an exception if one of a variety of internal consistency checks fails.
 */
private void assertConsistency(){
  if (false) {
    if (mSequence == UNINITIALIZED_SEQUENCE) {
      logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
      return;
    }
    if (mSequence != mParent.mSequence) {
      if (mSequence < mParent.mSequence) {
        logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
        return;
      }
 else       if (mSequence > mParent.mSequence) {
        logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
        return;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Throw an exception if one of a variety of internal consistency checks fails.
 */
private void assertConsistency(){
  if (false) {
    if (mSequence != mParent.mSequence) {
      if (mSequence < mParent.mSequence) {
        logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
        return;
      }
 else       if (mSequence > mParent.mSequence) {
        logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
        return;
      }
    }
  }
}
Program: 192131
Project: 192131
Buggy source:
void dismissRecentsToHome(boolean animateTaskViews){
  Runnable closeSystemWindows=new Runnable(){
    @Override public void run(){
      Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
    }
  }
;
  DismissRecentsToHomeAnimationStarted dismissEvent=new DismissRecentsToHomeAnimationStarted(animateTaskViews);
  dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
  dismissEvent.addPostAnimationCallback(closeSystemWindows);
  if (mTaskStackHorizontalGridView.getChildCount() > 0) {
    mHomeRecentsEnterExitAnimationHolder.startExitAnimation(dismissEvent);
  }
 else {
    closeSystemWindows.run();
    mFinishLaunchHomeRunnable.run();
  }
}

Fixed version (ground truth):
void dismissRecentsToHome(boolean animateTaskViews){
  Runnable closeSystemWindows=new Runnable(){
    @Override public void run(){
      Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
    }
  }
;
  DismissRecentsToHomeAnimationStarted dismissEvent=new DismissRecentsToHomeAnimationStarted(animateTaskViews);
  dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
  dismissEvent.addPostAnimationCallback(closeSystemWindows);
  if (mTaskStackHorizontalGridView.getChildCount() > 0 && animateTaskViews) {
    mHomeRecentsEnterExitAnimationHolder.startExitAnimation(dismissEvent);
  }
 else {
    closeSystemWindows.run();
    mFinishLaunchHomeRunnable.run();
  }
}
Program: 192132
Project: 192132
Buggy source:
public DismissAnimationsHolder(TaskCardView taskCardView){
  mTaskCardView=(LinearLayout)taskCardView.findViewById(R.id.recents_tv_card);
  mDismissArea=(LinearLayout)taskCardView.findViewById(R.id.card_dismiss);
  Resources res=taskCardView.getResources();
  mCardYDelta=res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
  mShortDuration=res.getInteger(R.integer.dismiss_short_duration);
  mLongDuration=res.getInteger(R.integer.dismiss_long_duration);
}

Fixed version (ground truth):
public DismissAnimationsHolder(TaskCardView taskCardView){
  mRecentsTvCard=(LinearLayout)taskCardView.findViewById(R.id.recents_tv_card);
  mDismissArea=(LinearLayout)taskCardView.findViewById(R.id.card_dismiss);
  Resources res=taskCardView.getResources();
  mCardYDelta=res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
  mShortDuration=res.getInteger(R.integer.dismiss_short_duration);
  mLongDuration=res.getInteger(R.integer.dismiss_long_duration);
}
Program: 192133
Project: 192133
Buggy source:
public void startExitAnimation(){
  mDismissArea.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).alpha(0.0f);
  mTaskCardView.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).translationYBy(-mCardYDelta).alpha(1.0f);
}

Fixed version (ground truth):
public void startExitAnimation(){
  mDismissArea.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).alpha(0.0f);
  mRecentsTvCard.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).translationYBy(-mCardYDelta).alpha(1.0f);
}
Program: 192134
Project: 192134
Buggy source:
public void startDismissAnimation(Animator.AnimatorListener listener){
  mDismissArea.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).alpha(0.0f);
  mTaskCardView.animate().setDuration(mLongDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).translationYBy(mCardYDelta).alpha(0.0f).setListener(listener);
}

Fixed version (ground truth):
public void startDismissAnimation(Animator.AnimatorListener listener){
  mDismissArea.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).alpha(0.0f);
  mRecentsTvCard.animate().setDuration(mLongDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).translationYBy(mCardYDelta).alpha(0.0f).setListener(listener);
}
Program: 192135
Project: 192135
Buggy source:
public void startEnterAnimation(){
  mDismissArea.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).alpha(1.0f);
  mTaskCardView.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).translationYBy(mCardYDelta).alpha(0.5f);
}

Fixed version (ground truth):
public void startEnterAnimation(){
  mDismissArea.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).alpha(1.0f);
  mRecentsTvCard.animate().setDuration(mShortDuration).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).translationYBy(mCardYDelta).alpha(0.5f);
}
Program: 192136
Project: 192136
Buggy source:
public TaskStackHorizontalGridView setTaskStackViewAdapter(TaskStackHorizontalViewAdapter taskStackViewAdapter){
  if (mTaskStackHorizontalView != null) {
    mTaskStackHorizontalView.setAdapter(taskStackViewAdapter);
  }
  return mTaskStackHorizontalView;
}

Fixed version (ground truth):
public TaskStackHorizontalGridView setTaskStackViewAdapter(TaskStackHorizontalViewAdapter taskStackViewAdapter){
  if (mTaskStackHorizontalView != null) {
    mTaskStackHorizontalView.setAdapter(taskStackViewAdapter);
    taskStackViewAdapter.setTaskStackHorizontalGridView(mTaskStackHorizontalView);
  }
  return mTaskStackHorizontalView;
}
Program: 192137
Project: 192137
Buggy source:
public void startDismissTaskAnimation(Animator.AnimatorListener listener){
  mDismissAnimationsHolder.startDismissAnimation(listener);
}

Fixed version (ground truth):
public void startDismissTaskAnimation(Animator.AnimatorListener listener){
  mDismissState=false;
  mDismissAnimationsHolder.startDismissAnimation(listener);
}
Program: 192138
Project: 192138
Buggy source:
@Override public void onStackTaskRemoved(TaskStack stack,Task removedTask,boolean wasFrontMostTask,Task newFrontMostTask,AnimationProps animation,boolean fromDockGesture){
  getAdapter().notifyItemRemoved(stack.getStackTasks().indexOf(removedTask));
  if (mFocusedTask == removedTask) {
    resetFocusedTask(removedTask);
  }
  if (mStack.getStackTaskCount() == 0) {
    boolean shouldFinishActivity=(mStack.getStackTaskCount() == 0);
    if (shouldFinishActivity) {
      EventBus.getDefault().send(new AllTaskViewsDismissedEvent(fromDockGesture ? R.string.recents_empty_message : R.string.recents_empty_message_dismissed_all));
    }
  }
}

Fixed version (ground truth):
@Override public void onStackTaskRemoved(TaskStack stack,Task removedTask,boolean wasFrontMostTask,Task newFrontMostTask,AnimationProps animation,boolean fromDockGesture){
  ((TaskStackHorizontalViewAdapter)getAdapter()).removeTask(removedTask);
  if (mFocusedTask == removedTask) {
    resetFocusedTask(removedTask);
  }
  if (mStack.getStackTaskCount() == 0) {
    boolean shouldFinishActivity=(mStack.getStackTaskCount() == 0);
    if (shouldFinishActivity) {
      EventBus.getDefault().send(new AllTaskViewsDismissedEvent(fromDockGesture ? R.string.recents_empty_message : R.string.recents_empty_message_dismissed_all));
    }
  }
}
Program: 192139
Project: 192139
Buggy source:
@Override public void onStackTaskAdded(TaskStack stack,Task newTask){
  getAdapter().notifyItemInserted(stack.getStackTasks().indexOf(newTask));
}

Fixed version (ground truth):
@Override public void onStackTaskAdded(TaskStack stack,Task newTask){
  ((TaskStackHorizontalViewAdapter)getAdapter()).addTaskAt(newTask,stack.indexOfStackTask(newTask));
}
Program: 192140
Project: 192140
Buggy source:
@Override public void onClick(View v){
  try {
    if (mTaskCardView.isInDismissState()) {
      mTaskCardView.startDismissTaskAnimation(getRemoveAtListener(getAdapterPosition(),mTaskCardView));
    }
 else {
      EventBus.getDefault().send(new LaunchTvTaskEvent(mTaskCardView,mTask,null,INVALID_STACK_ID));
      ((Activity)(v.getContext())).finish();
    }
  }
 catch (  Exception e) {
    Log.e(TAG,v.getContext().getString(R.string.recents_launch_error_message,mTask.title),e);
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  try {
    if (mTaskCardView.isInDismissState()) {
      mTaskCardView.startDismissTaskAnimation(getRemoveAtListener(getAdapterPosition(),mTaskCardView.getTask()));
    }
 else {
      EventBus.getDefault().send(new LaunchTvTaskEvent(mTaskCardView,mTask,null,INVALID_STACK_ID));
      ((Activity)(v.getContext())).finish();
    }
  }
 catch (  Exception e) {
    Log.e(TAG,v.getContext().getString(R.string.recents_launch_error_message,mTask.title),e);
  }
}
Program: 192141
Project: 192141
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  removeAt(position);
  EventBus.getDefault().send(new DeleteTaskDataEvent(taskCardView.getTask()));
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  removeAt(position);
  EventBus.getDefault().send(new DeleteTaskDataEvent(task));
}
Program: 192142
Project: 192142
Buggy source:
private Animator.AnimatorListener getRemoveAtListener(final int position,final TaskCardView taskCardView){
  return new Animator.AnimatorListener(){
    @Override public void onAnimationStart(    Animator animation){
    }
    @Override public void onAnimationEnd(    Animator animation){
      removeAt(position);
      EventBus.getDefault().send(new DeleteTaskDataEvent(taskCardView.getTask()));
    }
    @Override public void onAnimationCancel(    Animator animation){
    }
    @Override public void onAnimationRepeat(    Animator animation){
    }
  }
;
}

Fixed version (ground truth):
private Animator.AnimatorListener getRemoveAtListener(final int position,final Task task){
  return new Animator.AnimatorListener(){
    @Override public void onAnimationStart(    Animator animation){
    }
    @Override public void onAnimationEnd(    Animator animation){
      removeAt(position);
      EventBus.getDefault().send(new DeleteTaskDataEvent(task));
    }
    @Override public void onAnimationCancel(    Animator animation){
    }
    @Override public void onAnimationRepeat(    Animator animation){
    }
  }
;
}
Program: 192143
Project: 192143
Buggy source:
private void removeAt(int position){
  mTaskList.remove(position);
  notifyItemRemoved(position);
}

Fixed version (ground truth):
private void removeAt(int position){
  Task removedTask=mTaskList.remove(position);
  if (mGridView != null) {
    mGridView.getStack().removeTask(removedTask,AnimationProps.IMMEDIATE,false);
  }
  notifyItemRemoved(position);
}
Program: 192144
Project: 192144
Buggy source:
private void writeCompactedLongArray(Parcel out,long[] array,int num){
  for (int i=0; i < num; i++) {
    long val=array[i];
    if (val < 0) {
      Slog.w(TAG,"String_Node_Str" + val);
      val=0;
    }
    if (val <= Integer.MAX_VALUE) {
      out.writeInt((int)val);
    }
 else {
      int top=~((int)((val >> 32) & 0x7fffffff));
      int bottom=(int)(val & 0xfffffff);
      out.writeInt(top);
      out.writeInt(bottom);
    }
  }
}

Fixed version (ground truth):
private void writeCompactedLongArray(Parcel out,long[] array,int num){
  for (int i=0; i < num; i++) {
    long val=array[i];
    if (val < 0) {
      Slog.w(TAG,"String_Node_Str" + val);
      val=0;
    }
    if (val <= Integer.MAX_VALUE) {
      out.writeInt((int)val);
    }
 else {
      int top=~((int)((val >> 32) & 0x7fffffff));
      int bottom=(int)(val & 0x0ffffffffL);
      out.writeInt(top);
      out.writeInt(bottom);
    }
  }
}
Program: 192145
Project: 192145
Buggy source:
/** 
 * Allocates data in the buffer, and stores that key in the mapping for this table.
 * @param id    The id of the item (will be used in making the key)
 * @param count The number of bytes to allocate.  Must be less thanSparseMappingTable.ARRAY_SIZE.
 * @return The 'key' for this data value, which contains both the id itselfand the location in the long arrays that the data is actually stored but should be considered opaque to the caller.
 */
public int getOrAddKey(byte id,int count){
  if (mSequence == UNINITIALIZED_SEQUENCE) {
    mSequence=mParent.mSequence;
  }
  assertConsistency();
  final int idx=binarySearch(id);
  if (idx >= 0) {
    return mTable[idx];
  }
 else {
    final ArrayList<long[]> list=mParent.mLongs;
    int whichArray=list.size() - 1;
    long[] array=list.get(whichArray);
    if (mParent.mNextIndex + count > array.length) {
      array=new long[ARRAY_SIZE];
      list.add(array);
      whichArray++;
      mParent.mNextIndex=0;
    }
    final int key=(whichArray << ARRAY_SHIFT) | (mParent.mNextIndex << INDEX_SHIFT) | (((int)id) << ID_SHIFT);
    mParent.mNextIndex+=count;
    mTable=GrowingArrayUtils.insert(mTable != null ? mTable : EmptyArray.INT,mSize,~idx,key);
    mSize++;
    return key;
  }
}

Fixed version (ground truth):
/** 
 * Allocates data in the buffer, and stores that key in the mapping for this table.
 * @param id    The id of the item (will be used in making the key)
 * @param count The number of bytes to allocate.  Must be less thanSparseMappingTable.ARRAY_SIZE.
 * @return The 'key' for this data value, which contains both the id itselfand the location in the long arrays that the data is actually stored but should be considered opaque to the caller.
 */
public int getOrAddKey(byte id,int count){
  assertConsistency();
  final int idx=binarySearch(id);
  if (idx >= 0) {
    return mTable[idx];
  }
 else {
    final ArrayList<long[]> list=mParent.mLongs;
    int whichArray=list.size() - 1;
    long[] array=list.get(whichArray);
    if (mParent.mNextIndex + count > array.length) {
      array=new long[ARRAY_SIZE];
      list.add(array);
      whichArray++;
      mParent.mNextIndex=0;
    }
    final int key=(whichArray << ARRAY_SHIFT) | (mParent.mNextIndex << INDEX_SHIFT) | (((int)id) << ID_SHIFT);
    mParent.mNextIndex+=count;
    mTable=GrowingArrayUtils.insert(mTable != null ? mTable : EmptyArray.INT,mSize,~idx,key);
    mSize++;
    return key;
  }
}
Program: 192146
Project: 192146
Buggy source:
/** 
 * Clear out the table, and reset the sequence numbers so future writes without allocations will assert.
 */
public void resetTable(){
  mTable=null;
  mSize=0;
  mSequence=UNINITIALIZED_SEQUENCE;
}

Fixed version (ground truth):
/** 
 * Clear out the table, and reset the sequence numbers so future writes without allocations will assert.
 */
public void resetTable(){
  mTable=null;
  mSize=0;
  mSequence=mParent.mSequence;
}
Program: 192147
Project: 192147
Buggy source:
public String dumpInternalState(){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append(mSequence);
  sb.append("String_Node_Str");
  sb.append(mParent.mSequence);
  sb.append("String_Node_Str");
  sb.append(mParent.mLongs.size());
  sb.append("String_Node_Str");
  sb.append(mSize);
  sb.append("String_Node_Str");
  if (mTable == null) {
    sb.append("String_Node_Str");
  }
 else {
    final int N=mTable.length;
    sb.append('[');
    for (int i=0; i < N; i++) {
      final int key=mTable[i];
      sb.append("String_Node_Str");
      sb.append(Integer.toHexString((key >> ID_SHIFT) & ID_MASK));
      sb.append("String_Node_Str");
      sb.append(Integer.toHexString((key >> ARRAY_SHIFT) & ARRAY_MASK));
      sb.append("String_Node_Str");
      sb.append(Integer.toHexString((key >> INDEX_SHIFT) & INDEX_MASK));
      if (i != N - 1) {
        sb.append("String_Node_Str");
      }
    }
    sb.append(']');
  }
  sb.append("String_Node_Str");
  sb.append(getClass().getName());
  sb.append('}');
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Return a string for debugging.
 */
public String dumpInternalState(boolean includeData){
  final StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append(mSequence);
  sb.append("String_Node_Str");
  sb.append(mNextIndex);
  sb.append("String_Node_Str");
  final int N=mLongs.size();
  sb.append(N);
  sb.append("String_Node_Str");
  if (includeData) {
    for (int i=0; i < N; i++) {
      final long[] array=mLongs.get(i);
      for (int j=0; j < array.length; j++) {
        if (i == N - 1 && j == mNextIndex) {
          break;
        }
        sb.append(String.format("String_Node_Str",i,j,array[j],array[j]));
      }
    }
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 192148
Project: 192148
Buggy source:
/** 
 * Write the long array to the parcel in a compacted form.  Does not allow negative values in the array.
 */
private static void writeCompactedLongArray(Parcel out,long[] array,int num){
  for (int i=0; i < num; i++) {
    long val=array[i];
    if (val < 0) {
      Slog.w(TAG,"String_Node_Str" + val);
      val=0;
    }
    if (val <= Integer.MAX_VALUE) {
      out.writeInt((int)val);
    }
 else {
      int top=~((int)((val >> 32) & 0x7fffffff));
      int bottom=(int)(val & 0xfffffff);
      out.writeInt(top);
      out.writeInt(bottom);
    }
  }
}

Fixed version (ground truth):
/** 
 * Write the long array to the parcel in a compacted form.  Does not allow negative values in the array.
 */
private static void writeCompactedLongArray(Parcel out,long[] array,int num){
  for (int i=0; i < num; i++) {
    long val=array[i];
    if (val < 0) {
      Slog.w(TAG,"String_Node_Str" + val);
      val=0;
    }
    if (val <= Integer.MAX_VALUE) {
      out.writeInt((int)val);
    }
 else {
      int top=~((int)((val >> 32) & 0x7fffffff));
      int bottom=(int)(val & 0x0ffffffffL);
      out.writeInt(top);
      out.writeInt(bottom);
    }
  }
}
Program: 192149
Project: 192149
Buggy source:
/** 
 * Throw an exception if one of a variety of internal consistency checks fails.
 */
private void assertConsistency(){
  if (false) {
    if (mSequence == UNINITIALIZED_SEQUENCE) {
      logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
      return;
    }
    if (mSequence != mParent.mSequence) {
      if (mSequence < mParent.mSequence) {
        logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
        return;
      }
 else       if (mSequence > mParent.mSequence) {
        logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
        return;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Throw an exception if one of a variety of internal consistency checks fails.
 */
private void assertConsistency(){
  if (false) {
    if (mSequence != mParent.mSequence) {
      if (mSequence < mParent.mSequence) {
        logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
        return;
      }
 else       if (mSequence > mParent.mSequence) {
        logOrThrow("String_Node_Str" + "String_Node_Str" + dumpInternalState());
        return;
      }
    }
  }
}
Program: 192150
Project: 192150
Buggy source:
private boolean adjustForIME(final WindowState imeWin){
  final int dockedSide=getDockSide();
  final boolean dockedTopOrBottom=dockedSide == DOCKED_TOP || dockedSide == DOCKED_BOTTOM;
  final Rect adjustedBounds=mTmpAdjustedBounds;
  if (imeWin == null || !dockedTopOrBottom) {
    return false;
  }
  final Rect displayContentRect=mTmpRect;
  final Rect contentBounds=mTmpRect2;
  getDisplayContent().getContentRect(displayContentRect);
  contentBounds.set(displayContentRect);
  int imeTop=Math.max(imeWin.getDisplayFrameLw().top,contentBounds.top);
  if (imeWin.isAnimatingLw()) {
    imeTop=Math.max(imeTop,imeWin.getShownPositionLw().y);
  }
  imeTop+=imeWin.getGivenContentInsetsLw().top;
  if (contentBounds.bottom > imeTop) {
    contentBounds.bottom=imeTop;
  }
  if (mLastContentBounds.equals(contentBounds)) {
    return true;
  }
  mLastContentBounds.set(contentBounds);
  adjustedBounds.set(mBounds);
  final int yOffset=displayContentRect.bottom - contentBounds.bottom;
  if (dockedSide == DOCKED_TOP) {
    adjustedBounds.bottom=Math.max(adjustedBounds.bottom - yOffset,displayContentRect.top);
  }
 else {
    final int dividerWidth=getDisplayContent().mDividerControllerLocked.getContentWidth();
    adjustedBounds.top=Math.max(adjustedBounds.top - yOffset,displayContentRect.top + dividerWidth);
    adjustedBounds.bottom=adjustedBounds.top + mBounds.height();
  }
  return true;
}

Fixed version (ground truth):
private boolean adjustForIME(final WindowState imeWin){
  final int dockedSide=getDockSide();
  final boolean dockedTopOrBottom=dockedSide == DOCKED_TOP || dockedSide == DOCKED_BOTTOM;
  final Rect adjustedBounds=mTmpAdjustedBounds;
  if (imeWin == null || !dockedTopOrBottom) {
    return false;
  }
  final Rect displayContentRect=mTmpRect;
  final Rect contentBounds=mTmpRect2;
  getDisplayContent().getContentRect(displayContentRect);
  contentBounds.set(displayContentRect);
  int imeTop=Math.max(imeWin.getFrameLw().top,contentBounds.top);
  if (imeWin.isAnimatingLw()) {
    imeTop=Math.max(imeTop,imeWin.getShownPositionLw().y);
  }
  imeTop+=imeWin.getGivenContentInsetsLw().top;
  if (contentBounds.bottom > imeTop) {
    contentBounds.bottom=imeTop;
  }
  if (mLastContentBounds.equals(contentBounds)) {
    return true;
  }
  mLastContentBounds.set(contentBounds);
  adjustedBounds.set(mBounds);
  final int yOffset=displayContentRect.bottom - contentBounds.bottom;
  if (dockedSide == DOCKED_TOP) {
    adjustedBounds.bottom=Math.max(adjustedBounds.bottom - yOffset,displayContentRect.top);
  }
 else {
    final int dividerWidth=getDisplayContent().mDividerControllerLocked.getContentWidth();
    adjustedBounds.top=Math.max(adjustedBounds.top - yOffset,displayContentRect.top + dividerWidth);
    adjustedBounds.bottom=adjustedBounds.top + mBounds.height();
  }
  return true;
}
Program: 192151
Project: 192151
Buggy source:
/** 
 * Updates this stack when a scroll happens.
 */
public void updateFocusStateOnScroll(float stackScroll,float deltaScroll){
  if (deltaScroll == 0f) {
    return;
  }
  for (int i=mTaskIndexOverrideMap.size() - 1; i >= 0; i--) {
    int taskId=mTaskIndexOverrideMap.keyAt(i);
    float x=mTaskIndexMap.get(taskId);
    float overrideX=mTaskIndexOverrideMap.get(taskId,0f);
    float newOverrideX=overrideX + deltaScroll;
    mUnfocusedRange.offset(stackScroll);
    boolean outOfBounds=mUnfocusedRange.getNormalizedX(newOverrideX) < 0f || mUnfocusedRange.getNormalizedX(newOverrideX) > 1f;
    if (outOfBounds || (overrideX >= x && x >= newOverrideX) || (overrideX <= x && x <= newOverrideX)) {
      mTaskIndexOverrideMap.removeAt(i);
    }
 else     if ((overrideX >= x && deltaScroll <= 0f) || (overrideX <= x && deltaScroll >= 0f)) {
      mTaskIndexOverrideMap.put(taskId,newOverrideX);
    }
 else {
      float deltaX=overrideX - x;
      newOverrideX=Math.signum(deltaX) * (Math.abs(deltaX) - Math.abs(deltaScroll));
      mTaskIndexOverrideMap.put(taskId,x + newOverrideX);
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates this stack when a scroll happens.
 */
public float updateFocusStateOnScroll(float lastTargetStackScroll,float targetStackScroll,float lastStackScroll){
  if (targetStackScroll == lastStackScroll) {
    return targetStackScroll;
  }
  float deltaScroll=targetStackScroll - lastStackScroll;
  float deltaTargetScroll=targetStackScroll - lastTargetStackScroll;
  float newScroll=targetStackScroll;
  mUnfocusedRange.offset(targetStackScroll);
  for (int i=mTaskIndexOverrideMap.size() - 1; i >= 0; i--) {
    int taskId=mTaskIndexOverrideMap.keyAt(i);
    float x=mTaskIndexMap.get(taskId);
    float overrideX=mTaskIndexOverrideMap.get(taskId,0f);
    float newOverrideX=overrideX + deltaScroll;
    if (isInvalidOverrideX(x,overrideX,newOverrideX)) {
      mTaskIndexOverrideMap.removeAt(i);
    }
 else     if ((overrideX >= x && deltaScroll <= 0f) || (overrideX <= x && deltaScroll >= 0f)) {
      mTaskIndexOverrideMap.put(taskId,newOverrideX);
    }
 else {
      newScroll=lastStackScroll;
      newOverrideX=overrideX - deltaTargetScroll;
      if (isInvalidOverrideX(x,overrideX,newOverrideX)) {
        mTaskIndexOverrideMap.removeAt(i);
      }
 else {
        mTaskIndexOverrideMap.put(taskId,newOverrideX);
      }
    }
  }
  return newScroll;
}
Program: 192152
Project: 192152
Buggy source:
/** 
 * TaskStackViewScroller.TaskStackViewScrollerCallbacks 
 */
@Override public void onStackScrollChanged(float prevScroll,float curScroll,AnimationProps animation){
  mUIDozeTrigger.poke();
  if (animation != null) {
    relayoutTaskViewsOnNextFrame(animation);
  }
  mLayoutAlgorithm.updateFocusStateOnScroll(curScroll,curScroll - prevScroll);
  if (mEnterAnimationComplete) {
    if (prevScroll > SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && curScroll <= SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && mStack.getTaskCount() > 0) {
      EventBus.getDefault().send(new ShowStackActionButtonEvent(true));
    }
 else     if (prevScroll < HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && curScroll >= HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD) {
      EventBus.getDefault().send(new HideStackActionButtonEvent());
    }
  }
}

Fixed version (ground truth):
/** 
 * TaskStackViewScroller.TaskStackViewScrollerCallbacks 
 */
@Override public void onStackScrollChanged(float prevScroll,float curScroll,AnimationProps animation){
  mUIDozeTrigger.poke();
  if (animation != null) {
    relayoutTaskViewsOnNextFrame(animation);
  }
  if (mEnterAnimationComplete) {
    if (prevScroll > SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && curScroll <= SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && mStack.getTaskCount() > 0) {
      EventBus.getDefault().send(new ShowStackActionButtonEvent(true));
    }
 else     if (prevScroll < HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && curScroll >= HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD) {
      EventBus.getDefault().send(new HideStackActionButtonEvent());
    }
  }
}
Program: 192153
Project: 192153
Buggy source:
/** 
 * Called from the view draw, computes the next scroll. 
 */
boolean computeScroll(){
  if (mScroller.computeScrollOffset()) {
    float deltaP=mLayoutAlgorithm.getDeltaPForY(mFlingDownY,mScroller.getCurrY());
    float scroll=mFlingDownScrollP + deltaP;
    setStackScroll(scroll);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + scroll);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Called from the view draw, computes the next scroll. 
 */
boolean computeScroll(){
  if (mScroller.computeScrollOffset()) {
    float deltaP=mLayoutAlgorithm.getDeltaPForY(mFlingDownY,mScroller.getCurrY());
    mFlingDownScrollP+=setDeltaStackScroll(mFlingDownScrollP,deltaP);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + (mFlingDownScrollP + deltaP));
    }
    return true;
  }
  return false;
}
Program: 192154
Project: 192154
Buggy source:
/** 
 * Sets the current stack scroll, but indicates to the callback the preferred animation to update to this new scroll.
 */
public void setStackScroll(float s,AnimationProps animation){
  float prevStackScroll=mStackScrollP;
  mStackScrollP=s;
  if (mCb != null) {
    mCb.onStackScrollChanged(prevStackScroll,mStackScrollP,animation);
  }
}

Fixed version (ground truth):
/** 
 * Sets the current stack scroll, but indicates to the callback the preferred animation to update to this new scroll.
 */
public void setStackScroll(float newScroll,AnimationProps animation){
  float prevScroll=mStackScrollP;
  mStackScrollP=newScroll;
  if (mCb != null) {
    mCb.onStackScrollChanged(prevScroll,mStackScrollP,animation);
  }
}
Program: 192155
Project: 192155
Buggy source:
/** 
 * Sets the current stack scroll to the initial state when you first enter recents.
 * @return whether the stack progress changed.
 */
public boolean setStackScrollToInitialState(){
  float prevStackScrollP=mStackScrollP;
  setStackScroll(mLayoutAlgorithm.mInitialScrollP);
  return Float.compare(prevStackScrollP,mStackScrollP) != 0;
}

Fixed version (ground truth):
/** 
 * Sets the current stack scroll to the initial state when you first enter recents.
 * @return whether the stack progress changed.
 */
public boolean setStackScrollToInitialState(){
  float prevScroll=mStackScrollP;
  setStackScroll(mLayoutAlgorithm.mInitialScrollP);
  return Float.compare(prevScroll,mStackScrollP) != 0;
}
Program: 192156
Project: 192156
Buggy source:
/** 
 * Resets the task scroller. 
 */
void reset(){
  mStackScrollP=0f;
}

Fixed version (ground truth):
/** 
 * Resets the task scroller. 
 */
void reset(){
  mStackScrollP=0f;
  mLastDeltaP=0f;
}
Program: 192158
Project: 192158
Buggy source:
/** 
 * Updates this stack when a scroll happens.
 */
public void updateFocusStateOnScroll(float stackScroll,float deltaScroll){
  if (deltaScroll == 0f) {
    return;
  }
  for (int i=mTaskIndexOverrideMap.size() - 1; i >= 0; i--) {
    int taskId=mTaskIndexOverrideMap.keyAt(i);
    float x=mTaskIndexMap.get(taskId);
    float overrideX=mTaskIndexOverrideMap.get(taskId,0f);
    float newOverrideX=overrideX + deltaScroll;
    mUnfocusedRange.offset(stackScroll);
    boolean outOfBounds=mUnfocusedRange.getNormalizedX(newOverrideX) < 0f || mUnfocusedRange.getNormalizedX(newOverrideX) > 1f;
    if (outOfBounds || (overrideX >= x && x >= newOverrideX) || (overrideX <= x && x <= newOverrideX)) {
      mTaskIndexOverrideMap.removeAt(i);
    }
 else     if ((overrideX >= x && deltaScroll <= 0f) || (overrideX <= x && deltaScroll >= 0f)) {
      mTaskIndexOverrideMap.put(taskId,newOverrideX);
    }
 else {
      float deltaX=overrideX - x;
      newOverrideX=Math.signum(deltaX) * (Math.abs(deltaX) - Math.abs(deltaScroll));
      mTaskIndexOverrideMap.put(taskId,x + newOverrideX);
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates this stack when a scroll happens.
 */
public float updateFocusStateOnScroll(float lastTargetStackScroll,float targetStackScroll,float lastStackScroll){
  if (targetStackScroll == lastStackScroll) {
    return targetStackScroll;
  }
  float deltaScroll=targetStackScroll - lastStackScroll;
  float deltaTargetScroll=targetStackScroll - lastTargetStackScroll;
  float newScroll=targetStackScroll;
  mUnfocusedRange.offset(targetStackScroll);
  for (int i=mTaskIndexOverrideMap.size() - 1; i >= 0; i--) {
    int taskId=mTaskIndexOverrideMap.keyAt(i);
    float x=mTaskIndexMap.get(taskId);
    float overrideX=mTaskIndexOverrideMap.get(taskId,0f);
    float newOverrideX=overrideX + deltaScroll;
    if (isInvalidOverrideX(x,overrideX,newOverrideX)) {
      mTaskIndexOverrideMap.removeAt(i);
    }
 else     if ((overrideX >= x && deltaScroll <= 0f) || (overrideX <= x && deltaScroll >= 0f)) {
      mTaskIndexOverrideMap.put(taskId,newOverrideX);
    }
 else {
      newScroll=lastStackScroll;
      newOverrideX=overrideX - deltaTargetScroll;
      if (isInvalidOverrideX(x,overrideX,newOverrideX)) {
        mTaskIndexOverrideMap.removeAt(i);
      }
 else {
        mTaskIndexOverrideMap.put(taskId,newOverrideX);
      }
    }
  }
  return newScroll;
}
Program: 192159
Project: 192159
Buggy source:
/** 
 * TaskStackViewScroller.TaskStackViewScrollerCallbacks 
 */
@Override public void onStackScrollChanged(float prevScroll,float curScroll,AnimationProps animation){
  mUIDozeTrigger.poke();
  if (animation != null) {
    relayoutTaskViewsOnNextFrame(animation);
  }
  mLayoutAlgorithm.updateFocusStateOnScroll(curScroll,curScroll - prevScroll);
  if (mEnterAnimationComplete) {
    if (prevScroll > SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && curScroll <= SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && mStack.getTaskCount() > 0) {
      EventBus.getDefault().send(new ShowStackActionButtonEvent(true));
    }
 else     if (prevScroll < HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && curScroll >= HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD) {
      EventBus.getDefault().send(new HideStackActionButtonEvent());
    }
  }
}

Fixed version (ground truth):
/** 
 * TaskStackViewScroller.TaskStackViewScrollerCallbacks 
 */
@Override public void onStackScrollChanged(float prevScroll,float curScroll,AnimationProps animation){
  mUIDozeTrigger.poke();
  if (animation != null) {
    relayoutTaskViewsOnNextFrame(animation);
  }
  if (mEnterAnimationComplete) {
    if (prevScroll > SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && curScroll <= SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && mStack.getTaskCount() > 0) {
      EventBus.getDefault().send(new ShowStackActionButtonEvent(true));
    }
 else     if (prevScroll < HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD && curScroll >= HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD) {
      EventBus.getDefault().send(new HideStackActionButtonEvent());
    }
  }
}
Program: 192160
Project: 192160
Buggy source:
/** 
 * Called from the view draw, computes the next scroll. 
 */
boolean computeScroll(){
  if (mScroller.computeScrollOffset()) {
    float deltaP=mLayoutAlgorithm.getDeltaPForY(mFlingDownY,mScroller.getCurrY());
    float scroll=mFlingDownScrollP + deltaP;
    setStackScroll(scroll);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + scroll);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Called from the view draw, computes the next scroll. 
 */
boolean computeScroll(){
  if (mScroller.computeScrollOffset()) {
    float deltaP=mLayoutAlgorithm.getDeltaPForY(mFlingDownY,mScroller.getCurrY());
    mFlingDownScrollP+=setDeltaStackScroll(mFlingDownScrollP,deltaP);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + (mFlingDownScrollP + deltaP));
    }
    return true;
  }
  return false;
}
Program: 192161
Project: 192161
Buggy source:
/** 
 * Sets the current stack scroll, but indicates to the callback the preferred animation to update to this new scroll.
 */
public void setStackScroll(float s,AnimationProps animation){
  float prevStackScroll=mStackScrollP;
  mStackScrollP=s;
  if (mCb != null) {
    mCb.onStackScrollChanged(prevStackScroll,mStackScrollP,animation);
  }
}

Fixed version (ground truth):
/** 
 * Sets the current stack scroll, but indicates to the callback the preferred animation to update to this new scroll.
 */
public void setStackScroll(float newScroll,AnimationProps animation){
  float prevScroll=mStackScrollP;
  mStackScrollP=newScroll;
  if (mCb != null) {
    mCb.onStackScrollChanged(prevScroll,mStackScrollP,animation);
  }
}
Program: 192162
Project: 192162
Buggy source:
/** 
 * Sets the current stack scroll to the initial state when you first enter recents.
 * @return whether the stack progress changed.
 */
public boolean setStackScrollToInitialState(){
  float prevStackScrollP=mStackScrollP;
  setStackScroll(mLayoutAlgorithm.mInitialScrollP);
  return Float.compare(prevStackScrollP,mStackScrollP) != 0;
}

Fixed version (ground truth):
/** 
 * Sets the current stack scroll to the initial state when you first enter recents.
 * @return whether the stack progress changed.
 */
public boolean setStackScrollToInitialState(){
  float prevScroll=mStackScrollP;
  setStackScroll(mLayoutAlgorithm.mInitialScrollP);
  return Float.compare(prevScroll,mStackScrollP) != 0;
}
Program: 192163
Project: 192163
Buggy source:
/** 
 * Resets the task scroller. 
 */
void reset(){
  mStackScrollP=0f;
}

Fixed version (ground truth):
/** 
 * Resets the task scroller. 
 */
void reset(){
  mStackScrollP=0f;
  mLastDeltaP=0f;
}
Program: 192165
Project: 192165
Buggy source:
void dismissRecentsToHome(boolean animateTaskViews){
  Runnable closeSystemWindows=new Runnable(){
    @Override public void run(){
      Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
    }
  }
;
  DismissRecentsToHomeAnimationStarted dismissEvent=new DismissRecentsToHomeAnimationStarted(animateTaskViews);
  dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
  dismissEvent.addPostAnimationCallback(closeSystemWindows);
  if (mTaskStackHorizontalGridView.getChildCount() > 0) {
    mHomeRecentsEnterExitAnimationHolder.startExitAnimation(dismissEvent);
  }
 else {
    closeSystemWindows.run();
    mFinishLaunchHomeRunnable.run();
  }
}

Fixed version (ground truth):
void dismissRecentsToHome(boolean animateTaskViews){
  Runnable closeSystemWindows=new Runnable(){
    @Override public void run(){
      Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
    }
  }
;
  DismissRecentsToHomeAnimationStarted dismissEvent=new DismissRecentsToHomeAnimationStarted(animateTaskViews);
  dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
  dismissEvent.addPostAnimationCallback(closeSystemWindows);
  if (mTaskStackHorizontalGridView.getChildCount() > 0 && animateTaskViews) {
    mHomeRecentsEnterExitAnimationHolder.startExitAnimation(dismissEvent);
  }
 else {
    closeSystemWindows.run();
    mFinishLaunchHomeRunnable.run();
  }
}
Program: 192166
Project: 192166
Buggy source:
public DismissAnimationsHolder(TaskCardView taskCardView){
  mTaskCardView=(LinearLayout)taskCardView.findViewById(R.id.recents_tv_card);
  mDismissArea=(LinearLayout)taskCardView.findViewById(R.id.card_dismiss);
  Resources res=taskCardView.getResources();
  mCardYDelta=res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
  mShortDuration=res.getInteger(R.integer.dismiss_short_duration);
  mLongDuration=res.getInteger(R.integer.dismiss_long_duration);
}

Fixed version (ground truth):
public DismissAnimationsHolder(TaskCardView taskCardView){
  mRecentsTvCard=(LinearLayout)taskCardView.findViewById(R.id.recents_tv_card);
  mDismissArea=(LinearLayout)taskCardView.findViewById(R.id.card_dismiss);
  Resources res=taskCardView.getResources();
  mCardYDelta=res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
  mShortDuration=res.getInteger(R.integer.dismiss_short_duration);
  mLongDuration=res.getInteger(R.integer.dismiss_long_duration);
}