nus-yam/ex-repair huggingface dataset:
Program: 452
Project: 452
Buggy source:
/** 
 * Sets the relative padding. The view may add on the space required to display the scrollbars, depending on the style and visibility of the scrollbars. So the values returned from   {@link #getPaddingStart},   {@link #getPaddingTop},  {@link #getPaddingEnd} and {@link #getPaddingBottom} may be differentfrom the values set in this call.
 * @attr ref android.R.styleable#View_padding
 * @attr ref android.R.styleable#View_paddingBottom
 * @attr ref android.R.styleable#View_paddingStart
 * @attr ref android.R.styleable#View_paddingEnd
 * @attr ref android.R.styleable#View_paddingTop
 * @param start the start padding in pixels
 * @param top the top padding in pixels
 * @param end the end padding in pixels
 * @param bottom the bottom padding in pixels
 */
public void setPaddingRelative(int start,int top,int end,int bottom){
  resetResolvedPadding();
  mUserPaddingStart=start;
  mUserPaddingEnd=end;
switch (getLayoutDirection()) {
case LAYOUT_DIRECTION_RTL:
    mUserPaddingLeftInitial=end;
  mUserPaddingRightInitial=start;
internalSetPadding(end,top,start,bottom);
break;
case LAYOUT_DIRECTION_LTR:
default :
mUserPaddingLeftInitial=start;
mUserPaddingRightInitial=end;
internalSetPadding(start,top,end,bottom);
}
}

Fixed version (ground truth):
/** 
 * Sets the relative padding. The view may add on the space required to display the scrollbars, depending on the style and visibility of the scrollbars. So the values returned from   {@link #getPaddingStart},   {@link #getPaddingTop},  {@link #getPaddingEnd} and {@link #getPaddingBottom} may be differentfrom the values set in this call.
 * @attr ref android.R.styleable#View_padding
 * @attr ref android.R.styleable#View_paddingBottom
 * @attr ref android.R.styleable#View_paddingStart
 * @attr ref android.R.styleable#View_paddingEnd
 * @attr ref android.R.styleable#View_paddingTop
 * @param start the start padding in pixels
 * @param top the top padding in pixels
 * @param end the end padding in pixels
 * @param bottom the bottom padding in pixels
 */
public void setPaddingRelative(int start,int top,int end,int bottom){
  resetResolvedPadding();
  mUserPaddingStart=start;
  mUserPaddingEnd=end;
  mUseBackgroundPadding=false;
switch (getLayoutDirection()) {
case LAYOUT_DIRECTION_RTL:
    mUserPaddingLeftInitial=end;
  mUserPaddingRightInitial=start;
internalSetPadding(end,top,start,bottom);
break;
case LAYOUT_DIRECTION_LTR:
default :
mUserPaddingLeftInitial=start;
mUserPaddingRightInitial=end;
internalSetPadding(start,top,end,bottom);
}
}
Program: 453
Project: 453
Buggy source:
/** 
 * Resolves padding depending on layout direction, if applicable, and recomputes internal padding values to adjust for scroll bars.
 * @hide
 */
public void resolvePadding(){
  final int resolvedLayoutDirection=getLayoutDirection();
  if (!isRtlCompatibilityMode()) {
switch (resolvedLayoutDirection) {
case LAYOUT_DIRECTION_RTL:
      if (mUserPaddingStart != UNDEFINED_PADDING) {
        mUserPaddingRight=mUserPaddingStart;
      }
 else {
        mUserPaddingRight=mUserPaddingRightInitial;
      }
    if (mUserPaddingEnd != UNDEFINED_PADDING) {
      mUserPaddingLeft=mUserPaddingEnd;
    }
 else {
      mUserPaddingLeft=mUserPaddingLeftInitial;
    }
  break;
case LAYOUT_DIRECTION_LTR:
default :
if (mUserPaddingStart != UNDEFINED_PADDING) {
  mUserPaddingLeft=mUserPaddingStart;
}
 else {
  mUserPaddingLeft=mUserPaddingLeftInitial;
}
if (mUserPaddingEnd != UNDEFINED_PADDING) {
mUserPaddingRight=mUserPaddingEnd;
}
 else {
mUserPaddingRight=mUserPaddingRightInitial;
}
}
mUserPaddingBottom=(mUserPaddingBottom >= 0) ? mUserPaddingBottom : mPaddingBottom;
}
internalSetPadding(mUserPaddingLeft,mPaddingTop,mUserPaddingRight,mUserPaddingBottom);
onRtlPropertiesChanged(resolvedLayoutDirection);
mPrivateFlags2|=PFLAG2_PADDING_RESOLVED;
}

Fixed version (ground truth):
/** 
 * Resolves padding depending on layout direction, if applicable, and recomputes internal padding values to adjust for scroll bars.
 * @hide
 */
public void resolvePadding(){
  final int resolvedLayoutDirection=getLayoutDirection();
  if (!isRtlCompatibilityMode()) {
    if (mBackground != null && mUseBackgroundPadding) {
      Rect padding=sThreadLocal.get();
      if (padding == null) {
        padding=new Rect();
        sThreadLocal.set(padding);
      }
      mBackground.getPadding(padding);
      mUserPaddingLeftInitial=padding.left;
      mUserPaddingRightInitial=padding.right;
    }
switch (resolvedLayoutDirection) {
case LAYOUT_DIRECTION_RTL:
      if (mUserPaddingStart != UNDEFINED_PADDING) {
        mUserPaddingRight=mUserPaddingStart;
      }
 else {
        mUserPaddingRight=mUserPaddingRightInitial;
      }
    if (mUserPaddingEnd != UNDEFINED_PADDING) {
      mUserPaddingLeft=mUserPaddingEnd;
    }
 else {
      mUserPaddingLeft=mUserPaddingLeftInitial;
    }
  break;
case LAYOUT_DIRECTION_LTR:
default :
if (mUserPaddingStart != UNDEFINED_PADDING) {
  mUserPaddingLeft=mUserPaddingStart;
}
 else {
  mUserPaddingLeft=mUserPaddingLeftInitial;
}
if (mUserPaddingEnd != UNDEFINED_PADDING) {
mUserPaddingRight=mUserPaddingEnd;
}
 else {
mUserPaddingRight=mUserPaddingRightInitial;
}
}
mUserPaddingBottom=(mUserPaddingBottom >= 0) ? mUserPaddingBottom : mPaddingBottom;
}
internalSetPadding(mUserPaddingLeft,mPaddingTop,mUserPaddingRight,mUserPaddingBottom);
onRtlPropertiesChanged(resolvedLayoutDirection);
mPrivateFlags2|=PFLAG2_PADDING_RESOLVED;
}
Program: 454
Project: 454
Buggy source:
/** 
 * @hide
 */
@Override public Insets getOpticalInsets(){
  return (mCurrDrawable == null) ? Insets.NONE : mCurrDrawable.getOpticalInsets();
}

Fixed version (ground truth):
/** 
 * @hide
 */
@Override public Insets getOpticalInsets(){
  return mInsets;
}
Program: 456
Project: 456
Buggy source:
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  if (r != null) {
    padding.set(r);
    return true;
  }
  if (mCurrDrawable != null) {
    return mCurrDrawable.getPadding(padding);
  }
 else {
    return super.getPadding(padding);
  }
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result=true;
  if (r != null) {
    padding.set(r);
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}
Program: 457
Project: 457
Buggy source:
private final boolean unscheduleServiceRestartLocked(ServiceRecord r){
  if (r.restartDelay == 0) {
    return false;
  }
  r.resetRestartCounter();
  mRestartingServices.remove(r);
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}

Fixed version (ground truth):
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}
Program: 462
Project: 462
Buggy source:
private final boolean unscheduleServiceRestartLocked(ServiceRecord r){
  if (r.restartDelay == 0) {
    return false;
  }
  r.resetRestartCounter();
  mRestartingServices.remove(r);
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}

Fixed version (ground truth):
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}
Program: 467
Project: 467
Buggy source:
public boolean startReordering(){
  int dragViewIndex=getPageNearestToCenterOfScreen();
  mTempVisiblePagesRange[0]=0;
  mTempVisiblePagesRange[1]=getPageCount() - 1;
  boundByReorderablePages(true,mTempVisiblePagesRange);
  mReorderingStarted=true;
  if (mTempVisiblePagesRange[0] <= dragViewIndex && dragViewIndex <= mTempVisiblePagesRange[1]) {
    if (zoomOut()) {
      mDragView=getChildAt(dragViewIndex);
      onStartReordering();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean startReordering(){
  int dragViewIndex=getPageNearestToCenterOfScreen();
  mTempVisiblePagesRange[0]=0;
  mTempVisiblePagesRange[1]=getPageCount() - 1;
  boundByReorderablePages(true,mTempVisiblePagesRange);
  if (mTempVisiblePagesRange[0] <= dragViewIndex && dragViewIndex <= mTempVisiblePagesRange[1]) {
    mReorderingStarted=true;
    if (zoomOut()) {
      mDragView=getChildAt(dragViewIndex);
      onStartReordering();
    }
    return true;
  }
  return false;
}
Program: 468
Project: 468
Buggy source:
public boolean startReordering(){
  int dragViewIndex=getPageNearestToCenterOfScreen();
  mTempVisiblePagesRange[0]=0;
  mTempVisiblePagesRange[1]=getPageCount() - 1;
  boundByReorderablePages(true,mTempVisiblePagesRange);
  mReorderingStarted=true;
  if (mTempVisiblePagesRange[0] <= dragViewIndex && dragViewIndex <= mTempVisiblePagesRange[1]) {
    if (zoomOut()) {
      mDragView=getChildAt(dragViewIndex);
      onStartReordering();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean startReordering(){
  int dragViewIndex=getPageNearestToCenterOfScreen();
  mTempVisiblePagesRange[0]=0;
  mTempVisiblePagesRange[1]=getPageCount() - 1;
  boundByReorderablePages(true,mTempVisiblePagesRange);
  if (mTempVisiblePagesRange[0] <= dragViewIndex && dragViewIndex <= mTempVisiblePagesRange[1]) {
    mReorderingStarted=true;
    if (zoomOut()) {
      mDragView=getChildAt(dragViewIndex);
      onStartReordering();
    }
    return true;
  }
  return false;
}
Program: 470
Project: 470
Buggy source:
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}

Fixed version (ground truth):
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}
Program: 471
Project: 471
Buggy source:
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=pointerId;
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}

Fixed version (ground truth):
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}
Program: 472
Project: 472
Buggy source:
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}

Fixed version (ground truth):
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}
Program: 474
Project: 474
Buggy source:
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mLongPressingPointerId=-1;
    mLongPressingPointerDeltaX=0;
    mLongPressingPointerDeltaY=0;
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
}
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}

Fixed version (ground truth):
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    if (mLongPressingPointerId >= 0) {
      event=offsetEvent(event,-mLongPressingPointerDeltaX,-mLongPressingPointerDeltaY);
      mLongPressingPointerId=-1;
      mLongPressingPointerDeltaX=0;
      mLongPressingPointerDeltaY=0;
    }
    sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
default :
{
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}
}
}
Program: 475
Project: 475
Buggy source:
public boolean startReordering(){
  int dragViewIndex=getPageNearestToCenterOfScreen();
  mTempVisiblePagesRange[0]=0;
  mTempVisiblePagesRange[1]=getPageCount() - 1;
  boundByReorderablePages(true,mTempVisiblePagesRange);
  mReorderingStarted=true;
  if (mTempVisiblePagesRange[0] <= dragViewIndex && dragViewIndex <= mTempVisiblePagesRange[1]) {
    if (zoomOut()) {
      mDragView=getChildAt(dragViewIndex);
      onStartReordering();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean startReordering(){
  int dragViewIndex=getPageNearestToCenterOfScreen();
  mTempVisiblePagesRange[0]=0;
  mTempVisiblePagesRange[1]=getPageCount() - 1;
  boundByReorderablePages(true,mTempVisiblePagesRange);
  if (mTempVisiblePagesRange[0] <= dragViewIndex && dragViewIndex <= mTempVisiblePagesRange[1]) {
    mReorderingStarted=true;
    if (zoomOut()) {
      mDragView=getChildAt(dragViewIndex);
      onStartReordering();
    }
    return true;
  }
  return false;
}
Program: 477
Project: 477
Buggy source:
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}

Fixed version (ground truth):
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}
Program: 478
Project: 478
Buggy source:
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=pointerId;
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}

Fixed version (ground truth):
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}
Program: 479
Project: 479
Buggy source:
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}

Fixed version (ground truth):
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}
Program: 481
Project: 481
Buggy source:
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mLongPressingPointerId=-1;
    mLongPressingPointerDeltaX=0;
    mLongPressingPointerDeltaY=0;
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
}
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}

Fixed version (ground truth):
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    if (mLongPressingPointerId >= 0) {
      event=offsetEvent(event,-mLongPressingPointerDeltaX,-mLongPressingPointerDeltaY);
      mLongPressingPointerId=-1;
      mLongPressingPointerDeltaX=0;
      mLongPressingPointerDeltaY=0;
    }
    sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
default :
{
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}
}
}
Program: 483
Project: 483
Buggy source:
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}

Fixed version (ground truth):
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}
Program: 484
Project: 484
Buggy source:
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=pointerId;
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}

Fixed version (ground truth):
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}
Program: 485
Project: 485
Buggy source:
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}

Fixed version (ground truth):
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}
Program: 487
Project: 487
Buggy source:
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mLongPressingPointerId=-1;
    mLongPressingPointerDeltaX=0;
    mLongPressingPointerDeltaY=0;
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
}
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}

Fixed version (ground truth):
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    if (mLongPressingPointerId >= 0) {
      event=offsetEvent(event,-mLongPressingPointerDeltaX,-mLongPressingPointerDeltaY);
      mLongPressingPointerId=-1;
      mLongPressingPointerDeltaX=0;
      mLongPressingPointerDeltaY=0;
    }
    sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
default :
{
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}
}
}
Program: 488
Project: 488
Buggy source:
public boolean startReordering(){
  int dragViewIndex=getPageNearestToCenterOfScreen();
  mTempVisiblePagesRange[0]=0;
  mTempVisiblePagesRange[1]=getPageCount() - 1;
  boundByReorderablePages(true,mTempVisiblePagesRange);
  mReorderingStarted=true;
  if (mTempVisiblePagesRange[0] <= dragViewIndex && dragViewIndex <= mTempVisiblePagesRange[1]) {
    if (zoomOut()) {
      mDragView=getChildAt(dragViewIndex);
      onStartReordering();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean startReordering(){
  int dragViewIndex=getPageNearestToCenterOfScreen();
  mTempVisiblePagesRange[0]=0;
  mTempVisiblePagesRange[1]=getPageCount() - 1;
  boundByReorderablePages(true,mTempVisiblePagesRange);
  if (mTempVisiblePagesRange[0] <= dragViewIndex && dragViewIndex <= mTempVisiblePagesRange[1]) {
    mReorderingStarted=true;
    if (zoomOut()) {
      mDragView=getChildAt(dragViewIndex);
      onStartReordering();
    }
    return true;
  }
  return false;
}
Program: 490
Project: 490
Buggy source:
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}

Fixed version (ground truth):
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}
Program: 491
Project: 491
Buggy source:
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=pointerId;
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}

Fixed version (ground truth):
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}
Program: 492
Project: 492
Buggy source:
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}

Fixed version (ground truth):
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}
Program: 494
Project: 494
Buggy source:
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mLongPressingPointerId=-1;
    mLongPressingPointerDeltaX=0;
    mLongPressingPointerDeltaY=0;
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
}
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}

Fixed version (ground truth):
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    if (mLongPressingPointerId >= 0) {
      event=offsetEvent(event,-mLongPressingPointerDeltaX,-mLongPressingPointerDeltaY);
      mLongPressingPointerId=-1;
      mLongPressingPointerDeltaX=0;
      mLongPressingPointerDeltaY=0;
    }
    sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
default :
{
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}
}
}
Program: 496
Project: 496
Buggy source:
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}

Fixed version (ground truth):
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}
Program: 497
Project: 497
Buggy source:
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=pointerId;
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}

Fixed version (ground truth):
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}
Program: 498
Project: 498
Buggy source:
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}

Fixed version (ground truth):
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}
Program: 500
Project: 500
Buggy source:
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mLongPressingPointerId=-1;
    mLongPressingPointerDeltaX=0;
    mLongPressingPointerDeltaY=0;
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
}
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}

Fixed version (ground truth):
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    if (mLongPressingPointerId >= 0) {
      event=offsetEvent(event,-mLongPressingPointerDeltaX,-mLongPressingPointerDeltaY);
      mLongPressingPointerId=-1;
      mLongPressingPointerDeltaX=0;
      mLongPressingPointerDeltaY=0;
    }
    sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
default :
{
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}
}
}
Program: 501
Project: 501
Buggy source:
private final boolean unscheduleServiceRestartLocked(ServiceRecord r){
  if (r.restartDelay == 0) {
    return false;
  }
  r.resetRestartCounter();
  mRestartingServices.remove(r);
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}

Fixed version (ground truth):
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}
Program: 507
Project: 507
Buggy source:
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}

Fixed version (ground truth):
/** 
 * Handles a received pointer down event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerDown(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedDownEdgeFlags=event.getEdgeFlags();
  mReceivedPointersDown|=pointerFlag;
  mReceivedPointerDownX[pointerId]=event.getX(pointerIndex);
  mReceivedPointerDownY[pointerId]=event.getY(pointerIndex);
  mReceivedPointerDownTime[pointerId]=event.getEventTime();
  mPrimaryPointerId=pointerId;
}
Program: 508
Project: 508
Buggy source:
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerId=pointerId;
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}

Fixed version (ground truth):
/** 
 * Handles a received pointer up event.
 * @param pointerIndex The index of the pointer that has changed.
 * @param event The event to be handled.
 */
private void handleReceivedPointerUp(int pointerIndex,MotionEvent event){
  final int pointerId=event.getPointerId(pointerIndex);
  final int pointerFlag=(1 << pointerId);
  mLastReceivedUpPointerDownTime=getReceivedPointerDownTime(pointerId);
  mLastReceivedUpPointerDownX=mReceivedPointerDownX[pointerId];
  mLastReceivedUpPointerDownY=mReceivedPointerDownY[pointerId];
  mReceivedPointersDown&=~pointerFlag;
  mReceivedPointerDownX[pointerId]=0;
  mReceivedPointerDownY[pointerId]=0;
  mReceivedPointerDownTime[pointerId]=0;
  if (mPrimaryPointerId == pointerId) {
    mPrimaryPointerId=INVALID_POINTER_ID;
  }
}
Program: 509
Project: 509
Buggy source:
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerId=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}

Fixed version (ground truth):
/** 
 * Clears the internals state.
 */
public void clear(){
  Arrays.fill(mReceivedPointerDownX,0);
  Arrays.fill(mReceivedPointerDownY,0);
  Arrays.fill(mReceivedPointerDownTime,0);
  mReceivedPointersDown=0;
  mPrimaryPointerId=0;
  mLastReceivedUpPointerDownTime=0;
  mLastReceivedUpPointerDownX=0;
  mLastReceivedUpPointerDownY=0;
}
Program: 511
Project: 511
Buggy source:
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mLongPressingPointerId=-1;
    mLongPressingPointerDeltaX=0;
    mLongPressingPointerDeltaY=0;
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
}
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}

Fixed version (ground truth):
/** 
 * Handles a motion event in delegating state.
 * @param event The event to be handled.
 * @param policyFlags The policy flags associated with the event.
 */
private void handleMotionEventStateDelegating(MotionEvent event,int policyFlags){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
{
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
case MotionEvent.ACTION_UP:
{
    if (mLongPressingPointerId >= 0) {
      event=offsetEvent(event,-mLongPressingPointerDeltaX,-mLongPressingPointerDeltaY);
      mLongPressingPointerId=-1;
      mLongPressingPointerDeltaX=0;
      mLongPressingPointerDeltaY=0;
    }
    sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
    mAms.onTouchInteractionEnd();
    sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
    mCurrentState=STATE_TOUCH_EXPLORING;
  }
break;
case MotionEvent.ACTION_CANCEL:
{
clear(event,policyFlags);
}
break;
default :
{
sendMotionEvent(event,event.getAction(),ALL_POINTER_ID_BITS,policyFlags);
}
}
}