nus-yam/ex-repair huggingface dataset:
Program: 2875
Project: 2875
Buggy source:
/** 
 * Returns the resolved layout direction for this view.
 * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns{@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.For compatibility, this will return  {@link #LAYOUT_DIRECTION_LTR} if API versionis lower than  {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}.
 * @attr ref android.R.styleable#View_layoutDirection
 */
@ViewDebug.ExportedProperty(category="String_Node_Str",mapping={@ViewDebug.IntToString(from=LAYOUT_DIRECTION_LTR,to="String_Node_Str"),@ViewDebug.IntToString(from=LAYOUT_DIRECTION_RTL,to="String_Node_Str")}) public int getLayoutDirection(){
  final int targetSdkVersion=getContext().getApplicationInfo().targetSdkVersion;
  if (targetSdkVersion < JELLY_BEAN_MR1) {
    mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
    return LAYOUT_DIRECTION_LTR;
  }
  return ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) == PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
}

Fixed version (ground truth):
/** 
 * Returns the resolved layout direction for this view.
 * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns{@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.For compatibility, this will return  {@link #LAYOUT_DIRECTION_LTR} if API versionis lower than  {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}.
 * @attr ref android.R.styleable#View_layoutDirection
 */
@ViewDebug.ExportedProperty(category="String_Node_Str",mapping={@ViewDebug.IntToString(from=LAYOUT_DIRECTION_LTR,to="String_Node_Str"),@ViewDebug.IntToString(from=LAYOUT_DIRECTION_RTL,to="String_Node_Str")}) public int getLayoutDirection(){
  final int targetSdkVersion=getContext().getApplicationInfo().targetSdkVersion;
  if (targetSdkVersion < JELLY_BEAN_MR1) {
    mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
    return LAYOUT_DIRECTION_RESOLVED_DEFAULT;
  }
  return ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) == PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
}
Program: 2876
Project: 2876
Buggy source:
/** 
 * Resolve the text direction.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveTextDirection(){
  mPrivateFlags2&=~(PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_DIRECTION_RESOLVED_MASK);
  if (hasRtlSupport()) {
    final int textDirection=getRawTextDirection();
switch (textDirection) {
case TEXT_DIRECTION_INHERIT:
      if (!canResolveTextDirection()) {
        mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
        return false;
      }
    View parent=((View)mParent);
  if (!parent.isTextDirectionResolved()) {
    mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
    return false;
  }
final int parentResolvedDirection=parent.getTextDirection();
switch (parentResolvedDirection) {
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
mPrivateFlags2|=(parentResolvedDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
break;
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
mPrivateFlags2|=(textDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
}
 else {
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED;
return true;
}

Fixed version (ground truth):
/** 
 * Resolve the text direction.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveTextDirection(){
  mPrivateFlags2&=~(PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_DIRECTION_RESOLVED_MASK);
  if (hasRtlSupport()) {
    final int textDirection=getRawTextDirection();
switch (textDirection) {
case TEXT_DIRECTION_INHERIT:
      if (!canResolveTextDirection()) {
        mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
        return false;
      }
    if (!mParent.isTextDirectionResolved()) {
      mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
      return false;
    }
  final int parentResolvedDirection=mParent.getTextDirection();
switch (parentResolvedDirection) {
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
  mPrivateFlags2|=(parentResolvedDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
break;
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
mPrivateFlags2|=(textDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
}
 else {
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED;
return true;
}
Program: 2877
Project: 2877
Buggy source:
/** 
 * Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing that the parent directionality can and will be resolved before its children.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveLayoutDirection(){
  mPrivateFlags2&=~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK;
  if (hasRtlSupport()) {
switch ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) {
case LAYOUT_DIRECTION_INHERIT:
      if (!canResolveLayoutDirection())       return false;
    View parent=((View)mParent);
  if (!parent.isLayoutDirectionResolved())   return false;
if (parent.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
  mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
}
break;
case LAYOUT_DIRECTION_RTL:
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
break;
case LAYOUT_DIRECTION_LOCALE:
if ((LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()))) {
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
}
break;
default :
}
}
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
return true;
}

Fixed version (ground truth):
/** 
 * Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing that the parent directionality can and will be resolved before its children.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveLayoutDirection(){
  mPrivateFlags2&=~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK;
  if (hasRtlSupport()) {
switch ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) {
case LAYOUT_DIRECTION_INHERIT:
      if (!canResolveLayoutDirection())       return false;
    if (!mParent.isLayoutDirectionResolved())     return false;
  if (mParent.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
    mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
  }
break;
case LAYOUT_DIRECTION_RTL:
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
break;
case LAYOUT_DIRECTION_LOCALE:
if ((LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()))) {
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
}
break;
default :
}
}
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
return true;
}
Program: 2878
Project: 2878
Buggy source:
/** 
 * Check if layout direction resolution can be done.
 * @return true if layout direction resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveLayoutDirection(){
switch (getRawLayoutDirection()) {
case LAYOUT_DIRECTION_INHERIT:
    return (mParent != null) && (mParent instanceof ViewGroup) && ((ViewGroup)mParent).canResolveLayoutDirection();
default :
  return true;
}
}

Fixed version (ground truth):
/** 
 * Check if layout direction resolution can be done.
 * @return true if layout direction resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveLayoutDirection(){
switch (getRawLayoutDirection()) {
case LAYOUT_DIRECTION_INHERIT:
    return (mParent != null) && mParent.canResolveLayoutDirection();
default :
  return true;
}
}
Program: 2879
Project: 2879
Buggy source:
/** 
 * Check if text alignment resolution can be done.
 * @return true if text alignment resolution can be done otherwise return false.
 */
private boolean canResolveTextAlignment(){
switch (getRawTextAlignment()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && (mParent instanceof View) && ((View)mParent).canResolveTextAlignment();
default :
  return true;
}
}

Fixed version (ground truth):
/** 
 * Check if text alignment resolution can be done.
 * @return true if text alignment resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveTextAlignment(){
switch (getRawTextAlignment()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && mParent.canResolveTextAlignment();
default :
  return true;
}
}
Program: 2881
Project: 2881
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_alloc s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  int Z=0;
  s.set_dimX(X);
  s.set_dimY(Y);
  s.set_dimZ(Z);
  typeBuilder.setX(X).setY(Y);
  Allocation A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  typeBuilder=new Type.Builder(RS,Element.I32(RS));
  typeBuilder.setX(X).setY(Y).setFaces(true);
  Allocation AFaces=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aFaces(AFaces);
  typeBuilder.setFaces(false).setMipmaps(true);
  Allocation ALOD=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aLOD(ALOD);
  typeBuilder.setFaces(true).setMipmaps(true);
  Allocation AFacesLOD=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aFacesLOD(AFacesLOD);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_alloc s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  int Z=0;
  s.set_dimX(X);
  s.set_dimY(Y);
  s.set_dimZ(Z);
  typeBuilder.setX(X).setY(Y);
  Allocation A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  s.set_aRaw(A);
  typeBuilder=new Type.Builder(RS,Element.I32(RS));
  typeBuilder.setX(X).setY(Y).setFaces(true);
  Allocation AFaces=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aFaces(AFaces);
  typeBuilder.setFaces(false).setMipmaps(true);
  Allocation ALOD=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aLOD(ALOD);
  typeBuilder.setFaces(true).setMipmaps(true);
  Allocation AFacesLOD=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aFacesLOD(AFacesLOD);
  return;
}
Program: 2882
Project: 2882
Buggy source:
public void run(){
  RenderScript pRS=RenderScript.create(mCtx);
  ScriptC_alloc s=new ScriptC_alloc(pRS);
  pRS.setMessageHandler(mRsMessage);
  initializeGlobals(pRS,s);
  s.invoke_alloc_test();
  pRS.finish();
  waitForMessage();
  pRS.destroy();
}

Fixed version (ground truth):
public void run(){
  RenderScript pRS=RenderScript.create(mCtx);
  ScriptC_alloc s=new ScriptC_alloc(pRS);
  pRS.setMessageHandler(mRsMessage);
  initializeGlobals(pRS,s);
  s.forEach_root(s.get_aRaw());
  s.invoke_alloc_test();
  pRS.finish();
  waitForMessage();
  pRS.destroy();
}
Program: 2883
Project: 2883
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_foreach s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_foreach s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aRaw(A);
  return;
}
Program: 2884
Project: 2884
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_foreach_bounds s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  s.set_s(s);
  s.set_ain(A);
  s.set_aout(A);
  s.set_xStart(2);
  s.set_xEnd(5);
  s.set_yStart(3);
  s.set_yEnd(6);
  s.forEach_zero(A);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_foreach_bounds s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aRaw(A);
  s.set_s(s);
  s.set_ain(A);
  s.set_aout(A);
  s.set_xStart(2);
  s.set_xEnd(5);
  s.set_yStart(3);
  s.set_yEnd(6);
  s.forEach_zero(A);
  return;
}
Program: 2885
Project: 2885
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_noroot s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_noroot s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aRaw(A);
  return;
}
Program: 2891
Project: 2891
Buggy source:
/** 
 * Sets the fully qualified resource name of the source view's id. <p> <strong>Note:</strong> Cannot be called from an  {@link android.accessibilityservice.AccessibilityService}. This class is made immutable before being delivered to an AccessibilityService. </p>
 * @param viewId The id resource name.
 */
public void setViewIdResourceName(CharSequence viewIdResName){
  enforceNotSealed();
  mViewIdResourceName=viewIdResName;
}

Fixed version (ground truth):
/** 
 * Sets the fully qualified resource name of the source view's id. <p> <strong>Note:</strong> Cannot be called from an  {@link android.accessibilityservice.AccessibilityService}. This class is made immutable before being delivered to an AccessibilityService. </p>
 * @param viewIdResName The id resource name.
 */
public void setViewIdResourceName(CharSequence viewIdResName){
  enforceNotSealed();
  mViewIdResourceName=viewIdResName;
}
Program: 2892
Project: 2892
Buggy source:
/** 
 * Sets the fully qualified resource name of the source view's id. <p> <strong>Note:</strong> Cannot be called from an  {@link android.accessibilityservice.AccessibilityService}. This class is made immutable before being delivered to an AccessibilityService. </p>
 * @param viewId The id resource name.
 */
public void setViewIdResourceName(CharSequence viewIdResName){
  enforceNotSealed();
  mViewIdResourceName=viewIdResName;
}

Fixed version (ground truth):
/** 
 * Sets the fully qualified resource name of the source view's id. <p> <strong>Note:</strong> Cannot be called from an  {@link android.accessibilityservice.AccessibilityService}. This class is made immutable before being delivered to an AccessibilityService. </p>
 * @param viewIdResName The id resource name.
 */
public void setViewIdResourceName(CharSequence viewIdResName){
  enforceNotSealed();
  mViewIdResourceName=viewIdResName;
}
Program: 2893
Project: 2893
Buggy source:
public RelativeLayout(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  initFromAttributes(context,attrs);
  mAllowBrokenMeasureSpecs=context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1;
}

Fixed version (ground truth):
public RelativeLayout(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  initFromAttributes(context,attrs);
  mAllowBrokenMeasureSpecs=context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1;
  getDisplayWidth();
}
Program: 2895
Project: 2895
Buggy source:
public RelativeLayout(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  initFromAttributes(context,attrs);
  mAllowBrokenMeasureSpecs=context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1;
}

Fixed version (ground truth):
public RelativeLayout(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  initFromAttributes(context,attrs);
  mAllowBrokenMeasureSpecs=context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1;
  getDisplayWidth();
}
Program: 2898
Project: 2898
Buggy source:
final void activityStoppedLocked(ActivityRecord r,Bundle icicle,Bitmap thumbnail,CharSequence description){
  if (r.state != ActivityState.STOPPING) {
    Slog.i(TAG,"String_Node_Str" + r);
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    return;
  }
  if (DEBUG_SAVED_STATE)   Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str"+ icicle);
  if (icicle != null) {
    r.icicle=icicle;
    r.haveState=true;
    r.updateThumbnail(thumbnail,description);
  }
  if (!r.stopped) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    r.stopped=true;
    r.state=ActivityState.STOPPED;
    if (r.finishing) {
      r.clearOptionsLocked();
    }
 else {
      if (r.configDestroy) {
        destroyActivityLocked(r,true,false,"String_Node_Str");
        resumeTopActivityLocked(null);
      }
 else {
        ProcessRecord fgApp=null;
        if (mResumedActivity != null) {
          fgApp=mResumedActivity.app;
        }
 else         if (mPausingActivity != null) {
          fgApp=mPausingActivity.app;
        }
        if (r.app != null && fgApp != null && r.app != fgApp && r.lastVisibleTime > mService.mPreviousProcessVisibleTime && r.app != mService.mHomeProcess) {
          mService.mPreviousProcess=r.app;
          mService.mPreviousProcessVisibleTime=r.lastVisibleTime;
        }
      }
    }
  }
}

Fixed version (ground truth):
final void activityStoppedLocked(ActivityRecord r,Bundle icicle,Bitmap thumbnail,CharSequence description){
  if (r.state != ActivityState.STOPPING) {
    Slog.i(TAG,"String_Node_Str" + r);
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    return;
  }
  if (DEBUG_SAVED_STATE)   Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str"+ icicle);
  if (icicle != null) {
    r.icicle=icicle;
    r.haveState=true;
    r.launchCount=0;
    r.updateThumbnail(thumbnail,description);
  }
  if (!r.stopped) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    r.stopped=true;
    r.state=ActivityState.STOPPED;
    if (r.finishing) {
      r.clearOptionsLocked();
    }
 else {
      if (r.configDestroy) {
        destroyActivityLocked(r,true,false,"String_Node_Str");
        resumeTopActivityLocked(null);
      }
 else {
        ProcessRecord fgApp=null;
        if (mResumedActivity != null) {
          fgApp=mResumedActivity.app;
        }
 else         if (mPausingActivity != null) {
          fgApp=mPausingActivity.app;
        }
        if (r.app != null && fgApp != null && r.app != fgApp && r.lastVisibleTime > mService.mPreviousProcessVisibleTime && r.app != mService.mHomeProcess) {
          mService.mPreviousProcess=r.app;
          mService.mPreviousProcessVisibleTime=r.lastVisibleTime;
        }
      }
    }
  }
}
Program: 2899
Project: 2899
Buggy source:
/** 
 * Perform the common clean-up of an activity record.  This is called both as part of destroyActivityLocked() (when destroying the client-side representation) and cleaning things up as a result of its hosting processing going away, in which case there is no remaining client-side state to destroy so only the cleanup here is needed.
 */
final void cleanUpActivityLocked(ActivityRecord r,boolean cleanServices,boolean setState){
  if (mResumedActivity == r) {
    mResumedActivity=null;
  }
  if (mService.mFocusedActivity == r) {
    mService.mFocusedActivity=null;
  }
  r.configDestroy=false;
  r.frozenBeforeDestroy=false;
  if (setState) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    r.state=ActivityState.DESTROYED;
    r.app=null;
  }
  mFinishingActivities.remove(r);
  mWaitingVisibleActivities.remove(r);
  if (r.finishing && r.pendingResults != null) {
    for (    WeakReference<PendingIntentRecord> apr : r.pendingResults) {
      PendingIntentRecord rec=apr.get();
      if (rec != null) {
        mService.cancelIntentSenderLocked(rec,false);
      }
    }
    r.pendingResults=null;
  }
  if (cleanServices) {
    cleanUpActivityServicesLocked(r);
  }
  if (mService.mPendingThumbnails.size() > 0) {
    mService.mCancelledThumbnails.add(r);
  }
  removeTimeoutsForActivityLocked(r);
}

Fixed version (ground truth):
/** 
 * Perform the common clean-up of an activity record.  This is called both as part of destroyActivityLocked() (when destroying the client-side representation) and cleaning things up as a result of its hosting processing going away, in which case there is no remaining client-side state to destroy so only the cleanup here is needed.
 */
final void cleanUpActivityLocked(ActivityRecord r,boolean cleanServices,boolean setState){
  if (mResumedActivity == r) {
    mResumedActivity=null;
  }
  if (mService.mFocusedActivity == r) {
    mService.mFocusedActivity=null;
  }
  r.configDestroy=false;
  r.frozenBeforeDestroy=false;
  if (setState) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    r.state=ActivityState.DESTROYED;
    if (DEBUG_APP)     Slog.v(TAG,"String_Node_Str" + r);
    r.app=null;
  }
  mFinishingActivities.remove(r);
  mWaitingVisibleActivities.remove(r);
  if (r.finishing && r.pendingResults != null) {
    for (    WeakReference<PendingIntentRecord> apr : r.pendingResults) {
      PendingIntentRecord rec=apr.get();
      if (rec != null) {
        mService.cancelIntentSenderLocked(rec,false);
      }
    }
    r.pendingResults=null;
  }
  if (cleanServices) {
    cleanUpActivityServicesLocked(r);
  }
  if (mService.mPendingThumbnails.size() > 0) {
    mService.mCancelledThumbnails.add(r);
  }
  removeTimeoutsForActivityLocked(r);
}
Program: 2903
Project: 2903
Buggy source:
final void removeActivityFromHistoryLocked(ActivityRecord r){
  finishActivityResultsLocked(r,Activity.RESULT_CANCELED,null);
  r.makeFinishing();
  if (DEBUG_ADD_REMOVE) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str");
  }
  mHistory.remove(r);
  r.takeFromHistory();
  removeTimeoutsForActivityLocked(r);
  if (DEBUG_STATES)   Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
  r.state=ActivityState.DESTROYED;
  r.app=null;
  mService.mWindowManager.removeAppToken(r.appToken);
  if (VALIDATE_TOKENS) {
    validateAppTokensLocked();
  }
  cleanUpActivityServicesLocked(r);
  r.removeUriPermissionsLocked();
}

Fixed version (ground truth):
final void removeActivityFromHistoryLocked(ActivityRecord r){
  finishActivityResultsLocked(r,Activity.RESULT_CANCELED,null);
  r.makeFinishing();
  if (DEBUG_ADD_REMOVE) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str");
  }
  mHistory.remove(r);
  r.takeFromHistory();
  removeTimeoutsForActivityLocked(r);
  if (DEBUG_STATES)   Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
  r.state=ActivityState.DESTROYED;
  if (DEBUG_APP)   Slog.v(TAG,"String_Node_Str" + r);
  r.app=null;
  mService.mWindowManager.removeAppToken(r.appToken);
  if (VALIDATE_TOKENS) {
    validateAppTokensLocked();
  }
  cleanUpActivityServicesLocked(r);
  r.removeUriPermissionsLocked();
}
Program: 2905
Project: 2905
Buggy source:
final void activityStoppedLocked(ActivityRecord r,Bundle icicle,Bitmap thumbnail,CharSequence description){
  if (r.state != ActivityState.STOPPING) {
    Slog.i(TAG,"String_Node_Str" + r);
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    return;
  }
  if (DEBUG_SAVED_STATE)   Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str"+ icicle);
  if (icicle != null) {
    r.icicle=icicle;
    r.haveState=true;
    r.updateThumbnail(thumbnail,description);
  }
  if (!r.stopped) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    r.stopped=true;
    r.state=ActivityState.STOPPED;
    if (r.finishing) {
      r.clearOptionsLocked();
    }
 else {
      if (r.configDestroy) {
        destroyActivityLocked(r,true,false,"String_Node_Str");
        resumeTopActivityLocked(null);
      }
 else {
        ProcessRecord fgApp=null;
        if (mResumedActivity != null) {
          fgApp=mResumedActivity.app;
        }
 else         if (mPausingActivity != null) {
          fgApp=mPausingActivity.app;
        }
        if (r.app != null && fgApp != null && r.app != fgApp && r.lastVisibleTime > mService.mPreviousProcessVisibleTime && r.app != mService.mHomeProcess) {
          mService.mPreviousProcess=r.app;
          mService.mPreviousProcessVisibleTime=r.lastVisibleTime;
        }
      }
    }
  }
}

Fixed version (ground truth):
final void activityStoppedLocked(ActivityRecord r,Bundle icicle,Bitmap thumbnail,CharSequence description){
  if (r.state != ActivityState.STOPPING) {
    Slog.i(TAG,"String_Node_Str" + r);
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    return;
  }
  if (DEBUG_SAVED_STATE)   Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str"+ icicle);
  if (icicle != null) {
    r.icicle=icicle;
    r.haveState=true;
    r.launchCount=0;
    r.updateThumbnail(thumbnail,description);
  }
  if (!r.stopped) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    r.stopped=true;
    r.state=ActivityState.STOPPED;
    if (r.finishing) {
      r.clearOptionsLocked();
    }
 else {
      if (r.configDestroy) {
        destroyActivityLocked(r,true,false,"String_Node_Str");
        resumeTopActivityLocked(null);
      }
 else {
        ProcessRecord fgApp=null;
        if (mResumedActivity != null) {
          fgApp=mResumedActivity.app;
        }
 else         if (mPausingActivity != null) {
          fgApp=mPausingActivity.app;
        }
        if (r.app != null && fgApp != null && r.app != fgApp && r.lastVisibleTime > mService.mPreviousProcessVisibleTime && r.app != mService.mHomeProcess) {
          mService.mPreviousProcess=r.app;
          mService.mPreviousProcessVisibleTime=r.lastVisibleTime;
        }
      }
    }
  }
}
Program: 2906
Project: 2906
Buggy source:
/** 
 * Perform the common clean-up of an activity record.  This is called both as part of destroyActivityLocked() (when destroying the client-side representation) and cleaning things up as a result of its hosting processing going away, in which case there is no remaining client-side state to destroy so only the cleanup here is needed.
 */
final void cleanUpActivityLocked(ActivityRecord r,boolean cleanServices,boolean setState){
  if (mResumedActivity == r) {
    mResumedActivity=null;
  }
  if (mService.mFocusedActivity == r) {
    mService.mFocusedActivity=null;
  }
  r.configDestroy=false;
  r.frozenBeforeDestroy=false;
  if (setState) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    r.state=ActivityState.DESTROYED;
    r.app=null;
  }
  mFinishingActivities.remove(r);
  mWaitingVisibleActivities.remove(r);
  if (r.finishing && r.pendingResults != null) {
    for (    WeakReference<PendingIntentRecord> apr : r.pendingResults) {
      PendingIntentRecord rec=apr.get();
      if (rec != null) {
        mService.cancelIntentSenderLocked(rec,false);
      }
    }
    r.pendingResults=null;
  }
  if (cleanServices) {
    cleanUpActivityServicesLocked(r);
  }
  if (mService.mPendingThumbnails.size() > 0) {
    mService.mCancelledThumbnails.add(r);
  }
  removeTimeoutsForActivityLocked(r);
}

Fixed version (ground truth):
/** 
 * Perform the common clean-up of an activity record.  This is called both as part of destroyActivityLocked() (when destroying the client-side representation) and cleaning things up as a result of its hosting processing going away, in which case there is no remaining client-side state to destroy so only the cleanup here is needed.
 */
final void cleanUpActivityLocked(ActivityRecord r,boolean cleanServices,boolean setState){
  if (mResumedActivity == r) {
    mResumedActivity=null;
  }
  if (mService.mFocusedActivity == r) {
    mService.mFocusedActivity=null;
  }
  r.configDestroy=false;
  r.frozenBeforeDestroy=false;
  if (setState) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    r.state=ActivityState.DESTROYED;
    if (DEBUG_APP)     Slog.v(TAG,"String_Node_Str" + r);
    r.app=null;
  }
  mFinishingActivities.remove(r);
  mWaitingVisibleActivities.remove(r);
  if (r.finishing && r.pendingResults != null) {
    for (    WeakReference<PendingIntentRecord> apr : r.pendingResults) {
      PendingIntentRecord rec=apr.get();
      if (rec != null) {
        mService.cancelIntentSenderLocked(rec,false);
      }
    }
    r.pendingResults=null;
  }
  if (cleanServices) {
    cleanUpActivityServicesLocked(r);
  }
  if (mService.mPendingThumbnails.size() > 0) {
    mService.mCancelledThumbnails.add(r);
  }
  removeTimeoutsForActivityLocked(r);
}
Program: 2910
Project: 2910
Buggy source:
final void removeActivityFromHistoryLocked(ActivityRecord r){
  finishActivityResultsLocked(r,Activity.RESULT_CANCELED,null);
  r.makeFinishing();
  if (DEBUG_ADD_REMOVE) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str");
  }
  mHistory.remove(r);
  r.takeFromHistory();
  removeTimeoutsForActivityLocked(r);
  if (DEBUG_STATES)   Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
  r.state=ActivityState.DESTROYED;
  r.app=null;
  mService.mWindowManager.removeAppToken(r.appToken);
  if (VALIDATE_TOKENS) {
    validateAppTokensLocked();
  }
  cleanUpActivityServicesLocked(r);
  r.removeUriPermissionsLocked();
}

Fixed version (ground truth):
final void removeActivityFromHistoryLocked(ActivityRecord r){
  finishActivityResultsLocked(r,Activity.RESULT_CANCELED,null);
  r.makeFinishing();
  if (DEBUG_ADD_REMOVE) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str");
  }
  mHistory.remove(r);
  r.takeFromHistory();
  removeTimeoutsForActivityLocked(r);
  if (DEBUG_STATES)   Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
  r.state=ActivityState.DESTROYED;
  if (DEBUG_APP)   Slog.v(TAG,"String_Node_Str" + r);
  r.app=null;
  mService.mWindowManager.removeAppToken(r.appToken);
  if (VALIDATE_TOKENS) {
    validateAppTokensLocked();
  }
  cleanUpActivityServicesLocked(r);
  r.removeUriPermissionsLocked();
}
Program: 2912
Project: 2912
Buggy source:
final void activityStoppedLocked(ActivityRecord r,Bundle icicle,Bitmap thumbnail,CharSequence description){
  if (r.state != ActivityState.STOPPING) {
    Slog.i(TAG,"String_Node_Str" + r);
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    return;
  }
  if (DEBUG_SAVED_STATE)   Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str"+ icicle);
  if (icicle != null) {
    r.icicle=icicle;
    r.haveState=true;
    r.updateThumbnail(thumbnail,description);
  }
  if (!r.stopped) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    r.stopped=true;
    r.state=ActivityState.STOPPED;
    if (r.finishing) {
      r.clearOptionsLocked();
    }
 else {
      if (r.configDestroy) {
        destroyActivityLocked(r,true,false,"String_Node_Str");
        resumeTopActivityLocked(null);
      }
 else {
        ProcessRecord fgApp=null;
        if (mResumedActivity != null) {
          fgApp=mResumedActivity.app;
        }
 else         if (mPausingActivity != null) {
          fgApp=mPausingActivity.app;
        }
        if (r.app != null && fgApp != null && r.app != fgApp && r.lastVisibleTime > mService.mPreviousProcessVisibleTime && r.app != mService.mHomeProcess) {
          mService.mPreviousProcess=r.app;
          mService.mPreviousProcessVisibleTime=r.lastVisibleTime;
        }
      }
    }
  }
}

Fixed version (ground truth):
final void activityStoppedLocked(ActivityRecord r,Bundle icicle,Bitmap thumbnail,CharSequence description){
  if (r.state != ActivityState.STOPPING) {
    Slog.i(TAG,"String_Node_Str" + r);
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    return;
  }
  if (DEBUG_SAVED_STATE)   Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str"+ icicle);
  if (icicle != null) {
    r.icicle=icicle;
    r.haveState=true;
    r.launchCount=0;
    r.updateThumbnail(thumbnail,description);
  }
  if (!r.stopped) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    mHandler.removeMessages(STOP_TIMEOUT_MSG,r);
    r.stopped=true;
    r.state=ActivityState.STOPPED;
    if (r.finishing) {
      r.clearOptionsLocked();
    }
 else {
      if (r.configDestroy) {
        destroyActivityLocked(r,true,false,"String_Node_Str");
        resumeTopActivityLocked(null);
      }
 else {
        ProcessRecord fgApp=null;
        if (mResumedActivity != null) {
          fgApp=mResumedActivity.app;
        }
 else         if (mPausingActivity != null) {
          fgApp=mPausingActivity.app;
        }
        if (r.app != null && fgApp != null && r.app != fgApp && r.lastVisibleTime > mService.mPreviousProcessVisibleTime && r.app != mService.mHomeProcess) {
          mService.mPreviousProcess=r.app;
          mService.mPreviousProcessVisibleTime=r.lastVisibleTime;
        }
      }
    }
  }
}
Program: 2913
Project: 2913
Buggy source:
/** 
 * Perform the common clean-up of an activity record.  This is called both as part of destroyActivityLocked() (when destroying the client-side representation) and cleaning things up as a result of its hosting processing going away, in which case there is no remaining client-side state to destroy so only the cleanup here is needed.
 */
final void cleanUpActivityLocked(ActivityRecord r,boolean cleanServices,boolean setState){
  if (mResumedActivity == r) {
    mResumedActivity=null;
  }
  if (mService.mFocusedActivity == r) {
    mService.mFocusedActivity=null;
  }
  r.configDestroy=false;
  r.frozenBeforeDestroy=false;
  if (setState) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    r.state=ActivityState.DESTROYED;
    r.app=null;
  }
  mFinishingActivities.remove(r);
  mWaitingVisibleActivities.remove(r);
  if (r.finishing && r.pendingResults != null) {
    for (    WeakReference<PendingIntentRecord> apr : r.pendingResults) {
      PendingIntentRecord rec=apr.get();
      if (rec != null) {
        mService.cancelIntentSenderLocked(rec,false);
      }
    }
    r.pendingResults=null;
  }
  if (cleanServices) {
    cleanUpActivityServicesLocked(r);
  }
  if (mService.mPendingThumbnails.size() > 0) {
    mService.mCancelledThumbnails.add(r);
  }
  removeTimeoutsForActivityLocked(r);
}

Fixed version (ground truth):
/** 
 * Perform the common clean-up of an activity record.  This is called both as part of destroyActivityLocked() (when destroying the client-side representation) and cleaning things up as a result of its hosting processing going away, in which case there is no remaining client-side state to destroy so only the cleanup here is needed.
 */
final void cleanUpActivityLocked(ActivityRecord r,boolean cleanServices,boolean setState){
  if (mResumedActivity == r) {
    mResumedActivity=null;
  }
  if (mService.mFocusedActivity == r) {
    mService.mFocusedActivity=null;
  }
  r.configDestroy=false;
  r.frozenBeforeDestroy=false;
  if (setState) {
    if (DEBUG_STATES)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
    r.state=ActivityState.DESTROYED;
    if (DEBUG_APP)     Slog.v(TAG,"String_Node_Str" + r);
    r.app=null;
  }
  mFinishingActivities.remove(r);
  mWaitingVisibleActivities.remove(r);
  if (r.finishing && r.pendingResults != null) {
    for (    WeakReference<PendingIntentRecord> apr : r.pendingResults) {
      PendingIntentRecord rec=apr.get();
      if (rec != null) {
        mService.cancelIntentSenderLocked(rec,false);
      }
    }
    r.pendingResults=null;
  }
  if (cleanServices) {
    cleanUpActivityServicesLocked(r);
  }
  if (mService.mPendingThumbnails.size() > 0) {
    mService.mCancelledThumbnails.add(r);
  }
  removeTimeoutsForActivityLocked(r);
}
Program: 2917
Project: 2917
Buggy source:
final void removeActivityFromHistoryLocked(ActivityRecord r){
  finishActivityResultsLocked(r,Activity.RESULT_CANCELED,null);
  r.makeFinishing();
  if (DEBUG_ADD_REMOVE) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str");
  }
  mHistory.remove(r);
  r.takeFromHistory();
  removeTimeoutsForActivityLocked(r);
  if (DEBUG_STATES)   Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
  r.state=ActivityState.DESTROYED;
  r.app=null;
  mService.mWindowManager.removeAppToken(r.appToken);
  if (VALIDATE_TOKENS) {
    validateAppTokensLocked();
  }
  cleanUpActivityServicesLocked(r);
  r.removeUriPermissionsLocked();
}

Fixed version (ground truth):
final void removeActivityFromHistoryLocked(ActivityRecord r){
  finishActivityResultsLocked(r,Activity.RESULT_CANCELED,null);
  r.makeFinishing();
  if (DEBUG_ADD_REMOVE) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.i(TAG,"String_Node_Str" + r + "String_Node_Str");
  }
  mHistory.remove(r);
  r.takeFromHistory();
  removeTimeoutsForActivityLocked(r);
  if (DEBUG_STATES)   Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
  r.state=ActivityState.DESTROYED;
  if (DEBUG_APP)   Slog.v(TAG,"String_Node_Str" + r);
  r.app=null;
  mService.mWindowManager.removeAppToken(r.appToken);
  if (VALIDATE_TOKENS) {
    validateAppTokensLocked();
  }
  cleanUpActivityServicesLocked(r);
  r.removeUriPermissionsLocked();
}
Program: 2918
Project: 2918
Buggy source:
public RelativeLayout(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  initFromAttributes(context,attrs);
  mAllowBrokenMeasureSpecs=context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1;
}

Fixed version (ground truth):
public RelativeLayout(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  initFromAttributes(context,attrs);
  mAllowBrokenMeasureSpecs=context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1;
  getDisplayWidth();
}
Program: 2920
Project: 2920
Buggy source:
public <R>R runAction(Action<R> action,R errorResult,String method,boolean reconnect,boolean onlyEstablishedConnection){
synchronized (mStartLock) {
    try {
      if (mService == null) {
        Log.w(TAG,method + "String_Node_Str");
        return errorResult;
      }
      if (onlyEstablishedConnection && isEstablished()) {
        Log.w(TAG,method + "String_Node_Str");
        return errorResult;
      }
      return action.run(mService);
    }
 catch (    RemoteException ex) {
      Log.e(TAG,method + "String_Node_Str",ex);
      if (reconnect) {
        disconnect();
        initTts();
      }
      return errorResult;
    }
  }
}

Fixed version (ground truth):
public <R>R runAction(Action<R> action,R errorResult,String method,boolean reconnect,boolean onlyEstablishedConnection){
synchronized (mStartLock) {
    try {
      if (mService == null) {
        Log.w(TAG,method + "String_Node_Str");
        return errorResult;
      }
      if (onlyEstablishedConnection && !isEstablished()) {
        Log.w(TAG,method + "String_Node_Str");
        return errorResult;
      }
      return action.run(mService);
    }
 catch (    RemoteException ex) {
      Log.e(TAG,method + "String_Node_Str",ex);
      if (reconnect) {
        disconnect();
        initTts();
      }
      return errorResult;
    }
  }
}
Program: 2921
Project: 2921
Buggy source:
public <R>R runAction(Action<R> action,R errorResult,String method,boolean reconnect,boolean onlyEstablishedConnection){
synchronized (mStartLock) {
    try {
      if (mService == null) {
        Log.w(TAG,method + "String_Node_Str");
        return errorResult;
      }
      if (onlyEstablishedConnection && isEstablished()) {
        Log.w(TAG,method + "String_Node_Str");
        return errorResult;
      }
      return action.run(mService);
    }
 catch (    RemoteException ex) {
      Log.e(TAG,method + "String_Node_Str",ex);
      if (reconnect) {
        disconnect();
        initTts();
      }
      return errorResult;
    }
  }
}

Fixed version (ground truth):
public <R>R runAction(Action<R> action,R errorResult,String method,boolean reconnect,boolean onlyEstablishedConnection){
synchronized (mStartLock) {
    try {
      if (mService == null) {
        Log.w(TAG,method + "String_Node_Str");
        return errorResult;
      }
      if (onlyEstablishedConnection && !isEstablished()) {
        Log.w(TAG,method + "String_Node_Str");
        return errorResult;
      }
      return action.run(mService);
    }
 catch (    RemoteException ex) {
      Log.e(TAG,method + "String_Node_Str",ex);
      if (reconnect) {
        disconnect();
        initTts();
      }
      return errorResult;
    }
  }
}
Program: 2930
Project: 2930
Buggy source:
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedTrackball.updateTrackballDirection(this,event);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}

Fixed version (ground truth):
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedDpad.updateTouchPad(this,event,true);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}
Program: 2932
Project: 2932
Buggy source:
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedTrackball.updateTrackballDirection(this,event);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}

Fixed version (ground truth):
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedDpad.updateTouchPad(this,event,true);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}
Program: 2934
Project: 2934
Buggy source:
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedTrackball.updateTrackballDirection(this,event);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedTrackball.updateTrackballDirection(this,event);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}

Fixed version (ground truth):
private int deliverGenericMotionEventPostIme(QueuedInputEvent q){
  final MotionEvent event=(MotionEvent)q.mEvent;
  final int source=event.getSource();
  final boolean isJoystick=(source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0;
  final boolean isTouchPad=(source & InputDevice.SOURCE_CLASS_POSITION) != 0;
  if (mView == null || !mAdded) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_NOT_HANDLED;
  }
  if (mView.dispatchGenericMotionEvent(event)) {
    if (isJoystick) {
      updateJoystickDirection(event,false);
    }
 else     if (isTouchPad) {
      mSimulatedDpad.updateTouchPad(this,event,false);
    }
    return EVENT_HANDLED;
  }
  if (isJoystick) {
    updateJoystickDirection(event,true);
    return EVENT_HANDLED;
  }
  if (isTouchPad) {
    mSimulatedDpad.updateTouchPad(this,event,true);
    return EVENT_HANDLED;
  }
  return EVENT_NOT_HANDLED;
}