nus-yam/ex-repair huggingface dataset:
Program: 1256
Project: 1256
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
}
Program: 1258
Project: 1258
Buggy source:
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.addOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null && !mGlobalLayoutListenerAddedFilter) {
    treeObserver.addOnGlobalLayoutListener(this);
  }
  if (mAdapter != null && mDataSetObserver == null) {
    mDataSetObserver=new AdapterDataSetObserver();
    mAdapter.registerDataSetObserver(mDataSetObserver);
    mDataChanged=true;
    mOldItemCount=mItemCount;
    mItemCount=mAdapter.getCount();
  }
  mIsAttached=true;
}

Fixed version (ground truth):
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.addOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null && !mGlobalLayoutListenerAddedFilter) {
    treeObserver.addOnGlobalLayoutListener(this);
  }
  if (mAdapter != null && mDataSetObserver == null) {
    mDataSetObserver=new AdapterDataSetObserver();
    mAdapter.registerDataSetObserver(mDataSetObserver);
    mDataChanged=true;
    mOldItemCount=mItemCount;
    mItemCount=mAdapter.getCount();
  }
}
Program: 1259
Project: 1259
Buggy source:
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) {
    if (!mIsAttached && mAdapter != null) {
      mDataChanged=true;
      mOldItemCount=mItemCount;
      mItemCount=mAdapter.getCount();
    }
    resurrectSelection();
  }
}

Fixed version (ground truth):
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) {
    if (!isAttachedToWindow() && mAdapter != null) {
      mDataChanged=true;
      mOldItemCount=mItemCount;
      mItemCount=mAdapter.getCount();
    }
    resurrectSelection();
  }
}
Program: 1263
Project: 1263
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
}
Program: 1265
Project: 1265
Buggy source:
/** 
 * The same as   {@link #flattenToString()}, but abbreviates the class name if it is a suffix of the package.  The result can still be used with   {@link #unflattenFromString(String)}.
 * @return Returns a new String holding the package and class names.  Thisis represented as the package name, concatenated with a '/' and then the class name.
 * @see #unflattenFromString(String)
 */
public String flattenToShortString(){
  return mPackage + "String_Node_Str" + getShortClassName();
}

Fixed version (ground truth):
/** 
 * The same as   {@link #flattenToString()}, but abbreviates the class name if it is a suffix of the package.  The result can still be used with   {@link #unflattenFromString(String)}.
 * @return Returns a new String holding the package and class names.  Thisis represented as the package name, concatenated with a '/' and then the class name.
 * @see #unflattenFromString(String)
 */
public String flattenToShortString(){
  StringBuilder sb=new StringBuilder(mPackage.length() + mClass.length());
  appendShortString(sb,mPackage,mClass);
  return sb.toString();
}
Program: 1266
Project: 1266
Buggy source:
public String toString(){
  return "String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ service.info.name+ "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  StringBuilder sb=new StringBuilder(128);
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append(' ');
  service.appendComponentShortName(sb);
  sb.append('}');
  return sb.toString();
}
Program: 1267
Project: 1267
Buggy source:
public String toString(){
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  return "String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ ci.name+ "String_Node_Str"+ priority+ "String_Node_Str"+ preferredOrder+ "String_Node_Str"+ Integer.toHexString(match)+ "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  StringBuilder sb=new StringBuilder(128);
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append(' ');
  ComponentName.appendShortString(sb,ci.packageName,ci.name);
  if (priority != 0) {
    sb.append("String_Node_Str");
    sb.append(priority);
  }
  if (preferredOrder != 0) {
    sb.append("String_Node_Str");
    sb.append(preferredOrder);
  }
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(match));
  sb.append('}');
  return sb.toString();
}
Program: 1268
Project: 1268
Buggy source:
public ResolveListAdapter(Context context,Intent intent,Intent[] initialIntents,List<ResolveInfo> rList,int launchedFromUid){
  mIntent=new Intent(intent);
  mIntent.setComponent(null);
  mInitialIntents=initialIntents;
  mBaseResolveList=rList;
  mLaunchedFromUid=launchedFromUid;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mList=new ArrayList<DisplayResolveInfo>();
  rebuildList();
}

Fixed version (ground truth):
public ResolveListAdapter(Context context,Intent intent,Intent[] initialIntents,List<ResolveInfo> rList,int launchedFromUid){
  mIntent=new Intent(intent);
  mInitialIntents=initialIntents;
  mBaseResolveList=rList;
  mLaunchedFromUid=launchedFromUid;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mList=new ArrayList<DisplayResolveInfo>();
  rebuildList();
}
Program: 1271
Project: 1271
Buggy source:
private Intent makeMyIntent(){
  Intent intent=new Intent(getIntent());
  intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  return intent;
}

Fixed version (ground truth):
private Intent makeMyIntent(){
  Intent intent=new Intent(getIntent());
  intent.setComponent(null);
  intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  return intent;
}
Program: 1273
Project: 1273
Buggy source:
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.addOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null && !mGlobalLayoutListenerAddedFilter) {
    treeObserver.addOnGlobalLayoutListener(this);
  }
  if (mAdapter != null && mDataSetObserver == null) {
    mDataSetObserver=new AdapterDataSetObserver();
    mAdapter.registerDataSetObserver(mDataSetObserver);
    mDataChanged=true;
    mOldItemCount=mItemCount;
    mItemCount=mAdapter.getCount();
  }
  mIsAttached=true;
}

Fixed version (ground truth):
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.addOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null && !mGlobalLayoutListenerAddedFilter) {
    treeObserver.addOnGlobalLayoutListener(this);
  }
  if (mAdapter != null && mDataSetObserver == null) {
    mDataSetObserver=new AdapterDataSetObserver();
    mAdapter.registerDataSetObserver(mDataSetObserver);
    mDataChanged=true;
    mOldItemCount=mItemCount;
    mItemCount=mAdapter.getCount();
  }
}
Program: 1274
Project: 1274
Buggy source:
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) {
    if (!mIsAttached && mAdapter != null) {
      mDataChanged=true;
      mOldItemCount=mItemCount;
      mItemCount=mAdapter.getCount();
    }
    resurrectSelection();
  }
}

Fixed version (ground truth):
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) {
    if (!isAttachedToWindow() && mAdapter != null) {
      mDataChanged=true;
      mOldItemCount=mItemCount;
      mItemCount=mAdapter.getCount();
    }
    resurrectSelection();
  }
}
Program: 1278
Project: 1278
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
}
Program: 1280
Project: 1280
Buggy source:
/** 
 * The same as   {@link #flattenToString()}, but abbreviates the class name if it is a suffix of the package.  The result can still be used with   {@link #unflattenFromString(String)}.
 * @return Returns a new String holding the package and class names.  Thisis represented as the package name, concatenated with a '/' and then the class name.
 * @see #unflattenFromString(String)
 */
public String flattenToShortString(){
  return mPackage + "String_Node_Str" + getShortClassName();
}

Fixed version (ground truth):
/** 
 * The same as   {@link #flattenToString()}, but abbreviates the class name if it is a suffix of the package.  The result can still be used with   {@link #unflattenFromString(String)}.
 * @return Returns a new String holding the package and class names.  Thisis represented as the package name, concatenated with a '/' and then the class name.
 * @see #unflattenFromString(String)
 */
public String flattenToShortString(){
  StringBuilder sb=new StringBuilder(mPackage.length() + mClass.length());
  appendShortString(sb,mPackage,mClass);
  return sb.toString();
}
Program: 1281
Project: 1281
Buggy source:
public String toString(){
  return "String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ service.info.name+ "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  StringBuilder sb=new StringBuilder(128);
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append(' ');
  service.appendComponentShortName(sb);
  sb.append('}');
  return sb.toString();
}
Program: 1282
Project: 1282
Buggy source:
public String toString(){
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  return "String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ ci.name+ "String_Node_Str"+ priority+ "String_Node_Str"+ preferredOrder+ "String_Node_Str"+ Integer.toHexString(match)+ "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  StringBuilder sb=new StringBuilder(128);
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append(' ');
  ComponentName.appendShortString(sb,ci.packageName,ci.name);
  if (priority != 0) {
    sb.append("String_Node_Str");
    sb.append(priority);
  }
  if (preferredOrder != 0) {
    sb.append("String_Node_Str");
    sb.append(preferredOrder);
  }
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(match));
  sb.append('}');
  return sb.toString();
}
Program: 1283
Project: 1283
Buggy source:
public ResolveListAdapter(Context context,Intent intent,Intent[] initialIntents,List<ResolveInfo> rList,int launchedFromUid){
  mIntent=new Intent(intent);
  mIntent.setComponent(null);
  mInitialIntents=initialIntents;
  mBaseResolveList=rList;
  mLaunchedFromUid=launchedFromUid;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mList=new ArrayList<DisplayResolveInfo>();
  rebuildList();
}

Fixed version (ground truth):
public ResolveListAdapter(Context context,Intent intent,Intent[] initialIntents,List<ResolveInfo> rList,int launchedFromUid){
  mIntent=new Intent(intent);
  mInitialIntents=initialIntents;
  mBaseResolveList=rList;
  mLaunchedFromUid=launchedFromUid;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mList=new ArrayList<DisplayResolveInfo>();
  rebuildList();
}
Program: 1286
Project: 1286
Buggy source:
private Intent makeMyIntent(){
  Intent intent=new Intent(getIntent());
  intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  return intent;
}

Fixed version (ground truth):
private Intent makeMyIntent(){
  Intent intent=new Intent(getIntent());
  intent.setComponent(null);
  intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  return intent;
}
Program: 1288
Project: 1288
Buggy source:
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.addOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null && !mGlobalLayoutListenerAddedFilter) {
    treeObserver.addOnGlobalLayoutListener(this);
  }
  if (mAdapter != null && mDataSetObserver == null) {
    mDataSetObserver=new AdapterDataSetObserver();
    mAdapter.registerDataSetObserver(mDataSetObserver);
    mDataChanged=true;
    mOldItemCount=mItemCount;
    mItemCount=mAdapter.getCount();
  }
  mIsAttached=true;
}

Fixed version (ground truth):
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.addOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null && !mGlobalLayoutListenerAddedFilter) {
    treeObserver.addOnGlobalLayoutListener(this);
  }
  if (mAdapter != null && mDataSetObserver == null) {
    mDataSetObserver=new AdapterDataSetObserver();
    mAdapter.registerDataSetObserver(mDataSetObserver);
    mDataChanged=true;
    mOldItemCount=mItemCount;
    mItemCount=mAdapter.getCount();
  }
}
Program: 1289
Project: 1289
Buggy source:
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) {
    if (!mIsAttached && mAdapter != null) {
      mDataChanged=true;
      mOldItemCount=mItemCount;
      mItemCount=mAdapter.getCount();
    }
    resurrectSelection();
  }
}

Fixed version (ground truth):
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) {
    if (!isAttachedToWindow() && mAdapter != null) {
      mDataChanged=true;
      mOldItemCount=mItemCount;
      mItemCount=mAdapter.getCount();
    }
    resurrectSelection();
  }
}
Program: 1293
Project: 1293
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
  mIsAttached=false;
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.removeOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null) {
    treeObserver.removeOnGlobalLayoutListener(this);
    mGlobalLayoutListenerAddedFilter=false;
  }
  if (mAdapter != null && mDataSetObserver != null) {
    mAdapter.unregisterDataSetObserver(mDataSetObserver);
    mDataSetObserver=null;
  }
  if (mScrollStrictSpan != null) {
    mScrollStrictSpan.finish();
    mScrollStrictSpan=null;
  }
  if (mFlingStrictSpan != null) {
    mFlingStrictSpan.finish();
    mFlingStrictSpan=null;
  }
  if (mFlingRunnable != null) {
    removeCallbacks(mFlingRunnable);
  }
  if (mPositionScroller != null) {
    mPositionScroller.stop();
  }
  if (mClearScrollingCache != null) {
    removeCallbacks(mClearScrollingCache);
  }
  if (mPerformClick != null) {
    removeCallbacks(mPerformClick);
  }
  if (mTouchModeReset != null) {
    removeCallbacks(mTouchModeReset);
    mTouchModeReset.run();
  }
}
Program: 1295
Project: 1295
Buggy source:
/** 
 * The same as   {@link #flattenToString()}, but abbreviates the class name if it is a suffix of the package.  The result can still be used with   {@link #unflattenFromString(String)}.
 * @return Returns a new String holding the package and class names.  Thisis represented as the package name, concatenated with a '/' and then the class name.
 * @see #unflattenFromString(String)
 */
public String flattenToShortString(){
  return mPackage + "String_Node_Str" + getShortClassName();
}

Fixed version (ground truth):
/** 
 * The same as   {@link #flattenToString()}, but abbreviates the class name if it is a suffix of the package.  The result can still be used with   {@link #unflattenFromString(String)}.
 * @return Returns a new String holding the package and class names.  Thisis represented as the package name, concatenated with a '/' and then the class name.
 * @see #unflattenFromString(String)
 */
public String flattenToShortString(){
  StringBuilder sb=new StringBuilder(mPackage.length() + mClass.length());
  appendShortString(sb,mPackage,mClass);
  return sb.toString();
}
Program: 1296
Project: 1296
Buggy source:
public String toString(){
  return "String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ service.info.name+ "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  StringBuilder sb=new StringBuilder(128);
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append(' ');
  service.appendComponentShortName(sb);
  sb.append('}');
  return sb.toString();
}
Program: 1297
Project: 1297
Buggy source:
public String toString(){
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  return "String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ ci.name+ "String_Node_Str"+ priority+ "String_Node_Str"+ preferredOrder+ "String_Node_Str"+ Integer.toHexString(match)+ "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  StringBuilder sb=new StringBuilder(128);
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append(' ');
  ComponentName.appendShortString(sb,ci.packageName,ci.name);
  if (priority != 0) {
    sb.append("String_Node_Str");
    sb.append(priority);
  }
  if (preferredOrder != 0) {
    sb.append("String_Node_Str");
    sb.append(preferredOrder);
  }
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(match));
  sb.append('}');
  return sb.toString();
}
Program: 1298
Project: 1298
Buggy source:
public ResolveListAdapter(Context context,Intent intent,Intent[] initialIntents,List<ResolveInfo> rList,int launchedFromUid){
  mIntent=new Intent(intent);
  mIntent.setComponent(null);
  mInitialIntents=initialIntents;
  mBaseResolveList=rList;
  mLaunchedFromUid=launchedFromUid;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mList=new ArrayList<DisplayResolveInfo>();
  rebuildList();
}

Fixed version (ground truth):
public ResolveListAdapter(Context context,Intent intent,Intent[] initialIntents,List<ResolveInfo> rList,int launchedFromUid){
  mIntent=new Intent(intent);
  mInitialIntents=initialIntents;
  mBaseResolveList=rList;
  mLaunchedFromUid=launchedFromUid;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mList=new ArrayList<DisplayResolveInfo>();
  rebuildList();
}
Program: 1301
Project: 1301
Buggy source:
private Intent makeMyIntent(){
  Intent intent=new Intent(getIntent());
  intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  return intent;
}

Fixed version (ground truth):
private Intent makeMyIntent(){
  Intent intent=new Intent(getIntent());
  intent.setComponent(null);
  intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  return intent;
}
Program: 1303
Project: 1303
Buggy source:
/** 
 * The same as   {@link #flattenToString()}, but abbreviates the class name if it is a suffix of the package.  The result can still be used with   {@link #unflattenFromString(String)}.
 * @return Returns a new String holding the package and class names.  Thisis represented as the package name, concatenated with a '/' and then the class name.
 * @see #unflattenFromString(String)
 */
public String flattenToShortString(){
  return mPackage + "String_Node_Str" + getShortClassName();
}

Fixed version (ground truth):
/** 
 * The same as   {@link #flattenToString()}, but abbreviates the class name if it is a suffix of the package.  The result can still be used with   {@link #unflattenFromString(String)}.
 * @return Returns a new String holding the package and class names.  Thisis represented as the package name, concatenated with a '/' and then the class name.
 * @see #unflattenFromString(String)
 */
public String flattenToShortString(){
  StringBuilder sb=new StringBuilder(mPackage.length() + mClass.length());
  appendShortString(sb,mPackage,mClass);
  return sb.toString();
}
Program: 1304
Project: 1304
Buggy source:
public String toString(){
  return "String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ service.info.name+ "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  StringBuilder sb=new StringBuilder(128);
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append(' ');
  service.appendComponentShortName(sb);
  sb.append('}');
  return sb.toString();
}
Program: 1305
Project: 1305
Buggy source:
public String toString(){
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  return "String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ ci.name+ "String_Node_Str"+ priority+ "String_Node_Str"+ preferredOrder+ "String_Node_Str"+ Integer.toHexString(match)+ "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  StringBuilder sb=new StringBuilder(128);
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append(' ');
  ComponentName.appendShortString(sb,ci.packageName,ci.name);
  if (priority != 0) {
    sb.append("String_Node_Str");
    sb.append(priority);
  }
  if (preferredOrder != 0) {
    sb.append("String_Node_Str");
    sb.append(preferredOrder);
  }
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(match));
  sb.append('}');
  return sb.toString();
}
Program: 1306
Project: 1306
Buggy source:
public ResolveListAdapter(Context context,Intent intent,Intent[] initialIntents,List<ResolveInfo> rList,int launchedFromUid){
  mIntent=new Intent(intent);
  mIntent.setComponent(null);
  mInitialIntents=initialIntents;
  mBaseResolveList=rList;
  mLaunchedFromUid=launchedFromUid;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mList=new ArrayList<DisplayResolveInfo>();
  rebuildList();
}

Fixed version (ground truth):
public ResolveListAdapter(Context context,Intent intent,Intent[] initialIntents,List<ResolveInfo> rList,int launchedFromUid){
  mIntent=new Intent(intent);
  mInitialIntents=initialIntents;
  mBaseResolveList=rList;
  mLaunchedFromUid=launchedFromUid;
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mList=new ArrayList<DisplayResolveInfo>();
  rebuildList();
}
Program: 1309
Project: 1309
Buggy source:
private Intent makeMyIntent(){
  Intent intent=new Intent(getIntent());
  intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  return intent;
}

Fixed version (ground truth):
private Intent makeMyIntent(){
  Intent intent=new Intent(getIntent());
  intent.setComponent(null);
  intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  return intent;
}
Program: 1311
Project: 1311
Buggy source:
private final int updateLruProcessInternalLocked(ProcessRecord app,long now,int index,String what,Object obj,ProcessRecord srcApp){
  app.lastActivityTime=now;
  if (app.activities.size() > 0) {
    return index;
  }
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui < 0) {
    throw new IllegalStateException("String_Node_Str" + app + "String_Node_Str"+ what+ obj+ "String_Node_Str"+ srcApp);
  }
  if (lrui >= mLruProcessActivityStart) {
    return index;
  }
  mLruProcesses.remove(lrui);
  if (index > 0) {
    index--;
  }
  mLruProcesses.add(index,app);
  return index;
}

Fixed version (ground truth):
private final int updateLruProcessInternalLocked(ProcessRecord app,long now,int index,String what,Object obj,ProcessRecord srcApp){
  app.lastActivityTime=now;
  if (app.activities.size() > 0) {
    return index;
  }
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui < 0) {
    Log.wtf(TAG,"String_Node_Str" + app + "String_Node_Str"+ what+ "String_Node_Str"+ obj+ "String_Node_Str"+ srcApp);
    return index;
  }
  if (lrui >= mLruProcessActivityStart) {
    return index;
  }
  mLruProcesses.remove(lrui);
  if (index > 0) {
    index--;
  }
  mLruProcesses.add(index,app);
  return index;
}
Program: 1312
Project: 1312
Buggy source:
final void updateLruProcessLocked(ProcessRecord app,boolean oomAdj,boolean activityChange){
  final boolean hasActivity=app.activities.size() > 0;
  if (!activityChange && hasActivity) {
    return;
  }
  mLruSeq++;
  final long now=SystemClock.uptimeMillis();
  app.lastActivityTime=now;
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui >= 0) {
    if (lrui < mLruProcessActivityStart) {
      mLruProcessActivityStart--;
    }
    mLruProcesses.remove(lrui);
  }
  int nextIndex;
  if (!hasActivity) {
    mLruProcesses.add(mLruProcessActivityStart,app);
    nextIndex=mLruProcessActivityStart - 1;
    mLruProcessActivityStart++;
  }
 else {
    mLruProcesses.add(app);
    nextIndex=mLruProcessActivityStart;
  }
  for (int j=app.connections.size() - 1; j >= 0; j--) {
    ConnectionRecord cr=app.connections.valueAt(j);
    if (cr.binding != null && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cr.binding.service.app,now,nextIndex,"String_Node_Str",cr,app);
    }
  }
  for (int j=app.conProviders.size() - 1; j >= 0; j--) {
    ContentProviderRecord cpr=app.conProviders.get(j).provider;
    if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cpr.proc,now,nextIndex,"String_Node_Str",cpr,app);
    }
  }
  if (oomAdj) {
    updateOomAdjLocked();
  }
}

Fixed version (ground truth):
final void updateLruProcessLocked(ProcessRecord app,boolean oomAdj,boolean activityChange){
  final boolean hasActivity=app.activities.size() > 0;
  if (!activityChange && hasActivity) {
    return;
  }
  mLruSeq++;
  final long now=SystemClock.uptimeMillis();
  app.lastActivityTime=now;
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui >= 0) {
    if (lrui < mLruProcessActivityStart) {
      mLruProcessActivityStart--;
    }
    mLruProcesses.remove(lrui);
  }
  int nextIndex;
  if (!hasActivity) {
    mLruProcesses.add(mLruProcessActivityStart,app);
    nextIndex=mLruProcessActivityStart - 1;
    mLruProcessActivityStart++;
  }
 else {
    mLruProcesses.add(app);
    nextIndex=mLruProcessActivityStart;
  }
  for (int j=app.connections.size() - 1; j >= 0; j--) {
    ConnectionRecord cr=app.connections.valueAt(j);
    if (cr.binding != null && !cr.serviceDead && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cr.binding.service.app,now,nextIndex,"String_Node_Str",cr,app);
    }
  }
  for (int j=app.conProviders.size() - 1; j >= 0; j--) {
    ContentProviderRecord cpr=app.conProviders.get(j).provider;
    if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cpr.proc,now,nextIndex,"String_Node_Str",cpr,app);
    }
  }
  if (oomAdj) {
    updateOomAdjLocked();
  }
}
Program: 1313
Project: 1313
Buggy source:
private final int updateLruProcessInternalLocked(ProcessRecord app,long now,int index,String what,Object obj,ProcessRecord srcApp){
  app.lastActivityTime=now;
  if (app.activities.size() > 0) {
    return index;
  }
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui < 0) {
    throw new IllegalStateException("String_Node_Str" + app + "String_Node_Str"+ what+ obj+ "String_Node_Str"+ srcApp);
  }
  if (lrui >= mLruProcessActivityStart) {
    return index;
  }
  mLruProcesses.remove(lrui);
  if (index > 0) {
    index--;
  }
  mLruProcesses.add(index,app);
  return index;
}

Fixed version (ground truth):
private final int updateLruProcessInternalLocked(ProcessRecord app,long now,int index,String what,Object obj,ProcessRecord srcApp){
  app.lastActivityTime=now;
  if (app.activities.size() > 0) {
    return index;
  }
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui < 0) {
    Log.wtf(TAG,"String_Node_Str" + app + "String_Node_Str"+ what+ "String_Node_Str"+ obj+ "String_Node_Str"+ srcApp);
    return index;
  }
  if (lrui >= mLruProcessActivityStart) {
    return index;
  }
  mLruProcesses.remove(lrui);
  if (index > 0) {
    index--;
  }
  mLruProcesses.add(index,app);
  return index;
}
Program: 1314
Project: 1314
Buggy source:
final void updateLruProcessLocked(ProcessRecord app,boolean oomAdj,boolean activityChange){
  final boolean hasActivity=app.activities.size() > 0;
  if (!activityChange && hasActivity) {
    return;
  }
  mLruSeq++;
  final long now=SystemClock.uptimeMillis();
  app.lastActivityTime=now;
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui >= 0) {
    if (lrui < mLruProcessActivityStart) {
      mLruProcessActivityStart--;
    }
    mLruProcesses.remove(lrui);
  }
  int nextIndex;
  if (!hasActivity) {
    mLruProcesses.add(mLruProcessActivityStart,app);
    nextIndex=mLruProcessActivityStart - 1;
    mLruProcessActivityStart++;
  }
 else {
    mLruProcesses.add(app);
    nextIndex=mLruProcessActivityStart;
  }
  for (int j=app.connections.size() - 1; j >= 0; j--) {
    ConnectionRecord cr=app.connections.valueAt(j);
    if (cr.binding != null && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cr.binding.service.app,now,nextIndex,"String_Node_Str",cr,app);
    }
  }
  for (int j=app.conProviders.size() - 1; j >= 0; j--) {
    ContentProviderRecord cpr=app.conProviders.get(j).provider;
    if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cpr.proc,now,nextIndex,"String_Node_Str",cpr,app);
    }
  }
  if (oomAdj) {
    updateOomAdjLocked();
  }
}

Fixed version (ground truth):
final void updateLruProcessLocked(ProcessRecord app,boolean oomAdj,boolean activityChange){
  final boolean hasActivity=app.activities.size() > 0;
  if (!activityChange && hasActivity) {
    return;
  }
  mLruSeq++;
  final long now=SystemClock.uptimeMillis();
  app.lastActivityTime=now;
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui >= 0) {
    if (lrui < mLruProcessActivityStart) {
      mLruProcessActivityStart--;
    }
    mLruProcesses.remove(lrui);
  }
  int nextIndex;
  if (!hasActivity) {
    mLruProcesses.add(mLruProcessActivityStart,app);
    nextIndex=mLruProcessActivityStart - 1;
    mLruProcessActivityStart++;
  }
 else {
    mLruProcesses.add(app);
    nextIndex=mLruProcessActivityStart;
  }
  for (int j=app.connections.size() - 1; j >= 0; j--) {
    ConnectionRecord cr=app.connections.valueAt(j);
    if (cr.binding != null && !cr.serviceDead && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cr.binding.service.app,now,nextIndex,"String_Node_Str",cr,app);
    }
  }
  for (int j=app.conProviders.size() - 1; j >= 0; j--) {
    ContentProviderRecord cpr=app.conProviders.get(j).provider;
    if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cpr.proc,now,nextIndex,"String_Node_Str",cpr,app);
    }
  }
  if (oomAdj) {
    updateOomAdjLocked();
  }
}
Program: 1315
Project: 1315
Buggy source:
private final int updateLruProcessInternalLocked(ProcessRecord app,long now,int index,String what,Object obj,ProcessRecord srcApp){
  app.lastActivityTime=now;
  if (app.activities.size() > 0) {
    return index;
  }
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui < 0) {
    throw new IllegalStateException("String_Node_Str" + app + "String_Node_Str"+ what+ obj+ "String_Node_Str"+ srcApp);
  }
  if (lrui >= mLruProcessActivityStart) {
    return index;
  }
  mLruProcesses.remove(lrui);
  if (index > 0) {
    index--;
  }
  mLruProcesses.add(index,app);
  return index;
}

Fixed version (ground truth):
private final int updateLruProcessInternalLocked(ProcessRecord app,long now,int index,String what,Object obj,ProcessRecord srcApp){
  app.lastActivityTime=now;
  if (app.activities.size() > 0) {
    return index;
  }
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui < 0) {
    Log.wtf(TAG,"String_Node_Str" + app + "String_Node_Str"+ what+ "String_Node_Str"+ obj+ "String_Node_Str"+ srcApp);
    return index;
  }
  if (lrui >= mLruProcessActivityStart) {
    return index;
  }
  mLruProcesses.remove(lrui);
  if (index > 0) {
    index--;
  }
  mLruProcesses.add(index,app);
  return index;
}
Program: 1316
Project: 1316
Buggy source:
final void updateLruProcessLocked(ProcessRecord app,boolean oomAdj,boolean activityChange){
  final boolean hasActivity=app.activities.size() > 0;
  if (!activityChange && hasActivity) {
    return;
  }
  mLruSeq++;
  final long now=SystemClock.uptimeMillis();
  app.lastActivityTime=now;
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui >= 0) {
    if (lrui < mLruProcessActivityStart) {
      mLruProcessActivityStart--;
    }
    mLruProcesses.remove(lrui);
  }
  int nextIndex;
  if (!hasActivity) {
    mLruProcesses.add(mLruProcessActivityStart,app);
    nextIndex=mLruProcessActivityStart - 1;
    mLruProcessActivityStart++;
  }
 else {
    mLruProcesses.add(app);
    nextIndex=mLruProcessActivityStart;
  }
  for (int j=app.connections.size() - 1; j >= 0; j--) {
    ConnectionRecord cr=app.connections.valueAt(j);
    if (cr.binding != null && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cr.binding.service.app,now,nextIndex,"String_Node_Str",cr,app);
    }
  }
  for (int j=app.conProviders.size() - 1; j >= 0; j--) {
    ContentProviderRecord cpr=app.conProviders.get(j).provider;
    if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cpr.proc,now,nextIndex,"String_Node_Str",cpr,app);
    }
  }
  if (oomAdj) {
    updateOomAdjLocked();
  }
}

Fixed version (ground truth):
final void updateLruProcessLocked(ProcessRecord app,boolean oomAdj,boolean activityChange){
  final boolean hasActivity=app.activities.size() > 0;
  if (!activityChange && hasActivity) {
    return;
  }
  mLruSeq++;
  final long now=SystemClock.uptimeMillis();
  app.lastActivityTime=now;
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui >= 0) {
    if (lrui < mLruProcessActivityStart) {
      mLruProcessActivityStart--;
    }
    mLruProcesses.remove(lrui);
  }
  int nextIndex;
  if (!hasActivity) {
    mLruProcesses.add(mLruProcessActivityStart,app);
    nextIndex=mLruProcessActivityStart - 1;
    mLruProcessActivityStart++;
  }
 else {
    mLruProcesses.add(app);
    nextIndex=mLruProcessActivityStart;
  }
  for (int j=app.connections.size() - 1; j >= 0; j--) {
    ConnectionRecord cr=app.connections.valueAt(j);
    if (cr.binding != null && !cr.serviceDead && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cr.binding.service.app,now,nextIndex,"String_Node_Str",cr,app);
    }
  }
  for (int j=app.conProviders.size() - 1; j >= 0; j--) {
    ContentProviderRecord cpr=app.conProviders.get(j).provider;
    if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cpr.proc,now,nextIndex,"String_Node_Str",cpr,app);
    }
  }
  if (oomAdj) {
    updateOomAdjLocked();
  }
}
Program: 1317
Project: 1317
Buggy source:
private final int updateLruProcessInternalLocked(ProcessRecord app,long now,int index,String what,Object obj,ProcessRecord srcApp){
  app.lastActivityTime=now;
  if (app.activities.size() > 0) {
    return index;
  }
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui < 0) {
    throw new IllegalStateException("String_Node_Str" + app + "String_Node_Str"+ what+ obj+ "String_Node_Str"+ srcApp);
  }
  if (lrui >= mLruProcessActivityStart) {
    return index;
  }
  mLruProcesses.remove(lrui);
  if (index > 0) {
    index--;
  }
  mLruProcesses.add(index,app);
  return index;
}

Fixed version (ground truth):
private final int updateLruProcessInternalLocked(ProcessRecord app,long now,int index,String what,Object obj,ProcessRecord srcApp){
  app.lastActivityTime=now;
  if (app.activities.size() > 0) {
    return index;
  }
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui < 0) {
    Log.wtf(TAG,"String_Node_Str" + app + "String_Node_Str"+ what+ "String_Node_Str"+ obj+ "String_Node_Str"+ srcApp);
    return index;
  }
  if (lrui >= mLruProcessActivityStart) {
    return index;
  }
  mLruProcesses.remove(lrui);
  if (index > 0) {
    index--;
  }
  mLruProcesses.add(index,app);
  return index;
}
Program: 1318
Project: 1318
Buggy source:
final void updateLruProcessLocked(ProcessRecord app,boolean oomAdj,boolean activityChange){
  final boolean hasActivity=app.activities.size() > 0;
  if (!activityChange && hasActivity) {
    return;
  }
  mLruSeq++;
  final long now=SystemClock.uptimeMillis();
  app.lastActivityTime=now;
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui >= 0) {
    if (lrui < mLruProcessActivityStart) {
      mLruProcessActivityStart--;
    }
    mLruProcesses.remove(lrui);
  }
  int nextIndex;
  if (!hasActivity) {
    mLruProcesses.add(mLruProcessActivityStart,app);
    nextIndex=mLruProcessActivityStart - 1;
    mLruProcessActivityStart++;
  }
 else {
    mLruProcesses.add(app);
    nextIndex=mLruProcessActivityStart;
  }
  for (int j=app.connections.size() - 1; j >= 0; j--) {
    ConnectionRecord cr=app.connections.valueAt(j);
    if (cr.binding != null && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cr.binding.service.app,now,nextIndex,"String_Node_Str",cr,app);
    }
  }
  for (int j=app.conProviders.size() - 1; j >= 0; j--) {
    ContentProviderRecord cpr=app.conProviders.get(j).provider;
    if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cpr.proc,now,nextIndex,"String_Node_Str",cpr,app);
    }
  }
  if (oomAdj) {
    updateOomAdjLocked();
  }
}

Fixed version (ground truth):
final void updateLruProcessLocked(ProcessRecord app,boolean oomAdj,boolean activityChange){
  final boolean hasActivity=app.activities.size() > 0;
  if (!activityChange && hasActivity) {
    return;
  }
  mLruSeq++;
  final long now=SystemClock.uptimeMillis();
  app.lastActivityTime=now;
  int lrui=mLruProcesses.lastIndexOf(app);
  if (lrui >= 0) {
    if (lrui < mLruProcessActivityStart) {
      mLruProcessActivityStart--;
    }
    mLruProcesses.remove(lrui);
  }
  int nextIndex;
  if (!hasActivity) {
    mLruProcesses.add(mLruProcessActivityStart,app);
    nextIndex=mLruProcessActivityStart - 1;
    mLruProcessActivityStart++;
  }
 else {
    mLruProcesses.add(app);
    nextIndex=mLruProcessActivityStart;
  }
  for (int j=app.connections.size() - 1; j >= 0; j--) {
    ConnectionRecord cr=app.connections.valueAt(j);
    if (cr.binding != null && !cr.serviceDead && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cr.binding.service.app,now,nextIndex,"String_Node_Str",cr,app);
    }
  }
  for (int j=app.conProviders.size() - 1; j >= 0; j--) {
    ContentProviderRecord cpr=app.conProviders.get(j).provider;
    if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
      nextIndex=updateLruProcessInternalLocked(cpr.proc,now,nextIndex,"String_Node_Str",cpr,app);
    }
  }
  if (oomAdj) {
    updateOomAdjLocked();
  }
}