nus-yam/ex-repair huggingface dataset:
Program: 21824
Project: 21824
Buggy source:
public void commitPendingDataToDisk(){
  Parcel next;
synchronized (this) {
    next=mPendingWrite;
    mPendingWrite=null;
    mWriteLock.lock();
  }
  try {
    FileOutputStream stream=new FileOutputStream(mFile.chooseForWrite());
    stream.write(next.marshall());
    stream.flush();
    stream.close();
    mFile.commit();
  }
 catch (  IOException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
    mFile.rollback();
  }
 finally {
    next.recycle();
    mWriteLock.unlock();
  }
}

Fixed version (ground truth):
public void commitPendingDataToDisk(){
  final Parcel next;
synchronized (this) {
    next=mPendingWrite;
    mPendingWrite=null;
    if (next == null) {
      return;
    }
    mWriteLock.lock();
  }
  try {
    FileOutputStream stream=new FileOutputStream(mFile.chooseForWrite());
    stream.write(next.marshall());
    stream.flush();
    stream.close();
    mFile.commit();
  }
 catch (  IOException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
    mFile.rollback();
  }
 finally {
    next.recycle();
    mWriteLock.unlock();
  }
}
Program: 21825
Project: 21825
Buggy source:
public void commitPendingDataToDisk(){
  Parcel next;
synchronized (this) {
    next=mPendingWrite;
    mPendingWrite=null;
    mWriteLock.lock();
  }
  try {
    FileOutputStream stream=new FileOutputStream(mFile.chooseForWrite());
    stream.write(next.marshall());
    stream.flush();
    stream.close();
    mFile.commit();
  }
 catch (  IOException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
    mFile.rollback();
  }
 finally {
    next.recycle();
    mWriteLock.unlock();
  }
}

Fixed version (ground truth):
public void commitPendingDataToDisk(){
  final Parcel next;
synchronized (this) {
    next=mPendingWrite;
    mPendingWrite=null;
    if (next == null) {
      return;
    }
    mWriteLock.lock();
  }
  try {
    FileOutputStream stream=new FileOutputStream(mFile.chooseForWrite());
    stream.write(next.marshall());
    stream.flush();
    stream.close();
    mFile.commit();
  }
 catch (  IOException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
    mFile.rollback();
  }
 finally {
    next.recycle();
    mWriteLock.unlock();
  }
}
Program: 21826
Project: 21826
Buggy source:
/** 
 * <p>Generate the layout parameters for the popup window.</p>
 * @param token the window token used to bind the popup's window
 * @return the layout parameters to pass to the window manager
 */
private WindowManager.LayoutParams createPopupLayout(IBinder token){
  WindowManager.LayoutParams p=new WindowManager.LayoutParams();
  p.gravity=Gravity.LEFT | Gravity.TOP;
  p.width=mLastWidth=mWidth;
  p.height=mLastHeight=mHeight;
  if (mBackground != null) {
    p.format=mBackground.getOpacity();
  }
 else {
    p.format=PixelFormat.TRANSLUCENT;
  }
  p.flags=computeFlags(p.flags);
  p.type=WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
  p.token=token;
  p.softInputMode=mSoftInputMode;
  p.setTitle("String_Node_Str" + Integer.toHexString(hashCode()));
  return p;
}

Fixed version (ground truth):
/** 
 * <p>Generate the layout parameters for the popup window.</p>
 * @param token the window token used to bind the popup's window
 * @return the layout parameters to pass to the window manager
 */
private WindowManager.LayoutParams createPopupLayout(IBinder token){
  WindowManager.LayoutParams p=new WindowManager.LayoutParams();
  p.gravity=Gravity.LEFT | Gravity.TOP;
  p.width=mLastWidth=mWidth;
  p.height=mLastHeight=mHeight;
  if (mBackground != null) {
    p.format=mBackground.getOpacity();
  }
 else {
    p.format=PixelFormat.TRANSLUCENT;
  }
  p.flags=computeFlags(p.flags);
  p.type=mWindowLayoutType;
  p.token=token;
  p.softInputMode=mSoftInputMode;
  p.setTitle("String_Node_Str" + Integer.toHexString(hashCode()));
  return p;
}
Program: 21827
Project: 21827
Buggy source:
public HandleView(CursorController controller,int pos){
  super(TextView.this.mContext);
  mController=controller;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  setOrientation(pos);
}

Fixed version (ground truth):
public HandleView(CursorController controller,int pos){
  super(TextView.this.mContext);
  mController=controller;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  mContainer.setWindowLayoutType(WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL);
  setOrientation(pos);
}
Program: 21828
Project: 21828
Buggy source:
public HandleView(CursorController controller,Drawable handle){
  super(TextView.this.mContext);
  mController=controller;
  mDrawable=handle;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  final int handleWidth=mDrawable.getIntrinsicWidth();
  final int handleHeight=mDrawable.getIntrinsicHeight();
  mHotspotX=handleWidth * 0.5f;
  mHotspotY=-handleHeight * 0.2f;
}

Fixed version (ground truth):
public HandleView(CursorController controller,int pos){
  super(TextView.this.mContext);
  mController=controller;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  setOrientation(pos);
}
Program: 21829
Project: 21829
Buggy source:
private void moveTo(int x,int y){
  mPositionX=x - TextView.this.mScrollX;
  mPositionY=y - TextView.this.mScrollY;
  if (isPositionVisible()) {
    int[] coords=null;
    if (mContainer.isShowing()) {
      coords=mTempCoords;
      TextView.this.getLocationInWindow(coords);
      mContainer.update(coords[0] + mPositionX,coords[1] + mPositionY,mRight - mLeft,mBottom - mTop);
    }
 else {
      show();
    }
    if (mIsDragging) {
      if (coords == null) {
        coords=mTempCoords;
        TextView.this.getLocationInWindow(coords);
      }
      if (coords[0] != mLastParentX || coords[1] != mLastParentY) {
        mOffsetX+=coords[0] - mLastParentX;
        mOffsetY+=coords[1] - mLastParentY;
        mLastParentX=coords[0];
        mLastParentY=coords[1];
      }
    }
  }
 else {
    hide();
  }
}

Fixed version (ground truth):
private void moveTo(int x,int y){
  mPositionX=x - TextView.this.mScrollX;
  mPositionY=y - TextView.this.mScrollY;
  if (isPositionVisible()) {
    int[] coords=null;
    if (mContainer.isShowing()) {
      coords=mTempCoords;
      TextView.this.getLocationInWindow(coords);
      mContainer.update(coords[0] + mPositionX,coords[1] + mPositionY,mRight - mLeft,mBottom - mTop);
    }
 else {
      show();
    }
    if (mIsDragging) {
      if (coords == null) {
        coords=mTempCoords;
        TextView.this.getLocationInWindow(coords);
      }
      if (coords[0] != mLastParentX || coords[1] != mLastParentY) {
        mTouchToWindowOffsetX+=coords[0] - mLastParentX;
        mTouchToWindowOffsetY+=coords[1] - mLastParentY;
        mLastParentX=coords[0];
        mLastParentY=coords[1];
      }
    }
  }
 else {
    hide();
  }
}
Program: 21830
Project: 21830
Buggy source:
void positionAtCursor(final int offset,boolean bottom){
  final int width=mDrawable.getIntrinsicWidth();
  final int height=mDrawable.getIntrinsicHeight();
  final int line=mLayout.getLineForOffset(offset);
  final int lineTop=mLayout.getLineTop(line);
  final int lineBottom=mLayout.getLineBottom(line);
  final Rect bounds=sCursorControllerTempRect;
  bounds.left=(int)(mLayout.getPrimaryHorizontal(offset) - width / 2.0) + TextView.this.mScrollX;
  bounds.top=(bottom ? lineBottom : lineTop) + TextView.this.mScrollY;
  bounds.right=bounds.left + width;
  bounds.bottom=bounds.top + height;
  convertFromViewportToContentCoordinates(bounds);
  moveTo(bounds.left,bounds.top);
}

Fixed version (ground truth):
void positionAtCursor(final int offset,boolean bottom){
  final int width=mDrawable.getIntrinsicWidth();
  final int height=mDrawable.getIntrinsicHeight();
  final int line=mLayout.getLineForOffset(offset);
  final int lineTop=mLayout.getLineTop(line);
  final int lineBottom=mLayout.getLineBottom(line);
  final Rect bounds=sCursorControllerTempRect;
  bounds.left=(int)(mLayout.getPrimaryHorizontal(offset) - mHotspotX) + TextView.this.mScrollX;
  bounds.top=(bottom ? lineBottom : lineTop - mHeight) + TextView.this.mScrollY;
  bounds.right=bounds.left + width;
  bounds.bottom=bounds.top + height;
  convertFromViewportToContentCoordinates(bounds);
  moveTo(bounds.left,bounds.top);
}
Program: 21831
Project: 21831
Buggy source:
int getHysteresisOffset(int x,int y,int previousOffset){
  final Layout layout=getLayout();
  if (layout == null)   return -1;
  y-=getTotalPaddingTop();
  y=Math.max(0,y);
  y=Math.min(getHeight() - getTotalPaddingBottom() - 1,y);
  y+=getScrollY();
  int line=getLayout().getLineForVertical(y);
  final int previousLine=layout.getLineForOffset(previousOffset);
  final int previousLineTop=layout.getLineTop(previousLine);
  final int previousLineBottom=layout.getLineBottom(previousLine);
  final int hysteresisThreshold=(previousLineBottom - previousLineTop) / 6;
  if (((line == previousLine + 1) && ((y - previousLineBottom) < hysteresisThreshold)) || ((line == previousLine - 1) && ((previousLineTop - y) < hysteresisThreshold))) {
    line=previousLine;
  }
  return getOffsetForHorizontal(line,x);
}

Fixed version (ground truth):
int getHysteresisOffset(int x,int y,int previousOffset){
  final Layout layout=getLayout();
  if (layout == null)   return -1;
  y-=getTotalPaddingTop();
  y=Math.max(0,y);
  y=Math.min(getHeight() - getTotalPaddingBottom() - 1,y);
  y+=getScrollY();
  int line=getLayout().getLineForVertical(y);
  final int previousLine=layout.getLineForOffset(previousOffset);
  final int previousLineTop=layout.getLineTop(previousLine);
  final int previousLineBottom=layout.getLineBottom(previousLine);
  final int hysteresisThreshold=(previousLineBottom - previousLineTop) / 8;
  if (((line == previousLine + 1) && ((y - previousLineBottom) < hysteresisThreshold)) || ((line == previousLine - 1) && ((previousLineTop - y) < hysteresisThreshold))) {
    line=previousLine;
  }
  return getOffsetForHorizontal(line,x);
}
Program: 21832
Project: 21832
Buggy source:
InsertionPointCursorController(){
  Resources res=mContext.getResources();
  mHandle=new HandleView(this,res.getDrawable(mTextSelectHandleRes));
}

Fixed version (ground truth):
InsertionPointCursorController(){
  mHandle=new HandleView(this,HandleView.CENTER);
}
Program: 21833
Project: 21833
Buggy source:
public void updatePosition(){
  final int selectionStart=getSelectionStart();
  final int selectionEnd=getSelectionEnd();
  if ((selectionStart < 0) || (selectionEnd < 0)) {
    Log.w(LOG_TAG,"String_Node_Str");
    hide();
    return;
  }
  boolean oneLineSelection=mLayout.getLineForOffset(selectionStart) == mLayout.getLineForOffset(selectionEnd);
  mStartHandle.positionAtCursor(selectionStart,oneLineSelection);
  mEndHandle.positionAtCursor(selectionEnd,true);
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}

Fixed version (ground truth):
public void updatePosition(){
  final int selectionStart=getSelectionStart();
  final int selectionEnd=getSelectionEnd();
  if ((selectionStart < 0) || (selectionEnd < 0)) {
    Log.w(LOG_TAG,"String_Node_Str");
    hide();
    return;
  }
  mStartHandle.positionAtCursor(selectionStart,true);
  mEndHandle.positionAtCursor(selectionEnd,true);
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}
Program: 21834
Project: 21834
Buggy source:
SelectionModifierCursorController(){
  Resources res=mContext.getResources();
  mStartHandle=new HandleView(this,res.getDrawable(mTextSelectHandleLeftRes));
  mEndHandle=new HandleView(this,res.getDrawable(mTextSelectHandleRightRes));
}

Fixed version (ground truth):
SelectionModifierCursorController(){
  mStartHandle=new HandleView(this,HandleView.LEFT);
  mEndHandle=new HandleView(this,HandleView.RIGHT);
}
Program: 21835
Project: 21835
Buggy source:
private boolean isPositionVisible(){
  if (mIsDragging) {
    return true;
  }
  final int extendedPaddingTop=getExtendedPaddingTop();
  final int extendedPaddingBottom=getExtendedPaddingBottom();
  final int compoundPaddingLeft=getCompoundPaddingLeft();
  final int compoundPaddingRight=getCompoundPaddingRight();
  final TextView hostView=TextView.this;
  final int left=0;
  final int right=hostView.getWidth();
  final int top=0;
  final int bottom=hostView.getHeight();
  if (mTempRect == null) {
    mTempRect=new Rect();
  }
  final Rect clip=mTempRect;
  clip.left=left + compoundPaddingLeft;
  clip.top=top + extendedPaddingTop;
  clip.right=right - compoundPaddingRight;
  clip.bottom=bottom - extendedPaddingBottom;
  final ViewParent parent=hostView.getParent();
  if (parent == null || !parent.getChildVisibleRect(hostView,clip,null)) {
    return false;
  }
  final int[] coords=mTempCoords;
  hostView.getLocationInWindow(coords);
  final int posX=coords[0] + mPositionX + (int)mHotspotX;
  final int posY=coords[1] + mPositionY;
  return posX >= clip.left && posX <= clip.right && posY >= clip.top && posY + mHotspotY <= clip.bottom;
}

Fixed version (ground truth):
private boolean isPositionVisible(){
  if (mIsDragging) {
    return true;
  }
  final int extendedPaddingTop=getExtendedPaddingTop();
  final int extendedPaddingBottom=getExtendedPaddingBottom();
  final int compoundPaddingLeft=getCompoundPaddingLeft();
  final int compoundPaddingRight=getCompoundPaddingRight();
  final TextView hostView=TextView.this;
  final int left=0;
  final int right=hostView.getWidth();
  final int top=0;
  final int bottom=hostView.getHeight();
  if (mTempRect == null) {
    mTempRect=new Rect();
  }
  final Rect clip=mTempRect;
  clip.left=left + compoundPaddingLeft;
  clip.top=top + extendedPaddingTop;
  clip.right=right - compoundPaddingRight;
  clip.bottom=bottom - extendedPaddingBottom;
  final ViewParent parent=hostView.getParent();
  if (parent == null || !parent.getChildVisibleRect(hostView,clip,null)) {
    return false;
  }
  final int[] coords=mTempCoords;
  hostView.getLocationInWindow(coords);
  final int posX=coords[0] + mPositionX + (int)mHotspotX;
  final int posY=coords[1] + mPositionY + (int)mHotspotY;
  return posX >= clip.left && posX <= clip.right && posY >= clip.top && posY <= clip.bottom;
}
Program: 21836
Project: 21836
Buggy source:
/** 
 * <p>Generate the layout parameters for the popup window.</p>
 * @param token the window token used to bind the popup's window
 * @return the layout parameters to pass to the window manager
 */
private WindowManager.LayoutParams createPopupLayout(IBinder token){
  WindowManager.LayoutParams p=new WindowManager.LayoutParams();
  p.gravity=Gravity.LEFT | Gravity.TOP;
  p.width=mLastWidth=mWidth;
  p.height=mLastHeight=mHeight;
  if (mBackground != null) {
    p.format=mBackground.getOpacity();
  }
 else {
    p.format=PixelFormat.TRANSLUCENT;
  }
  p.flags=computeFlags(p.flags);
  p.type=WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
  p.token=token;
  p.softInputMode=mSoftInputMode;
  p.setTitle("String_Node_Str" + Integer.toHexString(hashCode()));
  return p;
}

Fixed version (ground truth):
/** 
 * <p>Generate the layout parameters for the popup window.</p>
 * @param token the window token used to bind the popup's window
 * @return the layout parameters to pass to the window manager
 */
private WindowManager.LayoutParams createPopupLayout(IBinder token){
  WindowManager.LayoutParams p=new WindowManager.LayoutParams();
  p.gravity=Gravity.LEFT | Gravity.TOP;
  p.width=mLastWidth=mWidth;
  p.height=mLastHeight=mHeight;
  if (mBackground != null) {
    p.format=mBackground.getOpacity();
  }
 else {
    p.format=PixelFormat.TRANSLUCENT;
  }
  p.flags=computeFlags(p.flags);
  p.type=mWindowLayoutType;
  p.token=token;
  p.softInputMode=mSoftInputMode;
  p.setTitle("String_Node_Str" + Integer.toHexString(hashCode()));
  return p;
}
Program: 21837
Project: 21837
Buggy source:
public HandleView(CursorController controller,int pos){
  super(TextView.this.mContext);
  mController=controller;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  setOrientation(pos);
}

Fixed version (ground truth):
public HandleView(CursorController controller,int pos){
  super(TextView.this.mContext);
  mController=controller;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  mContainer.setWindowLayoutType(WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL);
  setOrientation(pos);
}
Program: 21838
Project: 21838
Buggy source:
void onInputQueueCreated(InputQueue queue);

Fixed version (ground truth):
/** 
 * Called when the given InputQueue is now associated with the thread making this call, so it can start receiving events from it.
 */
void onInputQueueCreated(InputQueue queue);
Program: 21839
Project: 21839
Buggy source:
void onInputQueueDestroyed(InputQueue queue);

Fixed version (ground truth):
/** 
 * Called when the given InputQueue is no longer associated with the thread and thus not dispatching events.
 */
void onInputQueueDestroyed(InputQueue queue);
Program: 21840
Project: 21840
Buggy source:
/** 
 * @deprecated This functionality will be removed in the future; please donot use. Control whether this activity is required to be persistent.  By default activities are not persistent; setting this to true will prevent the system from stopping this activity or its process when running low on resources. <p><em>You should avoid using this method</em>, it has severe negative consequences on how well the system can manage its resources.  A better approach is to implement an application service that you control with {@link Context#startService} and {@link Context#stopService}.
 * @param isPersistent Control whether the current activity must bepersistent, true if so, false for the normal behavior.
 */
@Deprecated public void setPersistent(boolean isPersistent){
  if (mParent == null) {
    try {
      ActivityManagerNative.getDefault().setPersistent(mToken,isPersistent);
    }
 catch (    RemoteException e) {
    }
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @deprecated As of {@link android.os.Build.VERSION_CODES#GINGERBREAD}this is a no-op.
 */
@Deprecated public void setPersistent(boolean isPersistent){
}
Program: 21849
Project: 21849
Buggy source:
ProcessRecord(BatteryStatsImpl.Uid.Proc _batteryStats,IApplicationThread _thread,ApplicationInfo _info,String _processName){
  batteryStats=_batteryStats;
  info=_info;
  processName=_processName;
  pkgList.add(_info.packageName);
  thread=_thread;
  maxAdj=ActivityManagerService.EMPTY_APP_ADJ;
  hiddenAdj=ActivityManagerService.HIDDEN_APP_MIN_ADJ;
  curRawAdj=setRawAdj=-100;
  curAdj=setAdj=-100;
  persistent=false;
  removed=false;
  persistentActivities=0;
}

Fixed version (ground truth):
ProcessRecord(BatteryStatsImpl.Uid.Proc _batteryStats,IApplicationThread _thread,ApplicationInfo _info,String _processName){
  batteryStats=_batteryStats;
  info=_info;
  processName=_processName;
  pkgList.add(_info.packageName);
  thread=_thread;
  maxAdj=ActivityManagerService.EMPTY_APP_ADJ;
  hiddenAdj=ActivityManagerService.HIDDEN_APP_MIN_ADJ;
  curRawAdj=setRawAdj=-100;
  curAdj=setAdj=-100;
  persistent=false;
  removed=false;
}
Program: 21850
Project: 21850
Buggy source:
public void dump(Printer pw,String prefix){
  super.dumpFront(pw,prefix);
  if (className != null) {
    pw.println(prefix + "String_Node_Str" + className);
  }
  if (permission != null) {
    pw.println(prefix + "String_Node_Str" + permission);
  }
  pw.println(prefix + "String_Node_Str" + processName);
  pw.println(prefix + "String_Node_Str" + taskAffinity);
  pw.println(prefix + "String_Node_Str" + uid+ "String_Node_Str"+ Integer.toHexString(flags)+ "String_Node_Str"+ Integer.toHexString(theme));
  pw.println(prefix + "String_Node_Str" + sourceDir);
  if (!sourceDir.equals(publicSourceDir)) {
    pw.println(prefix + "String_Node_Str" + publicSourceDir);
  }
  if (resourceDirs != null) {
    pw.println(prefix + "String_Node_Str" + resourceDirs);
  }
  pw.println(prefix + "String_Node_Str" + dataDir);
  if (sharedLibraryFiles != null) {
    pw.println(prefix + "String_Node_Str" + sharedLibraryFiles);
  }
  pw.println(prefix + "String_Node_Str" + enabled+ "String_Node_Str"+ targetSdkVersion);
  if (manageSpaceActivityName != null) {
    pw.println(prefix + "String_Node_Str" + manageSpaceActivityName);
  }
  if (descriptionRes != 0) {
    pw.println(prefix + "String_Node_Str" + Integer.toHexString(descriptionRes));
  }
  super.dumpBack(pw,prefix);
}

Fixed version (ground truth):
public void dump(Printer pw,String prefix){
  super.dumpFront(pw,prefix);
  if (className != null) {
    pw.println(prefix + "String_Node_Str" + className);
  }
  if (permission != null) {
    pw.println(prefix + "String_Node_Str" + permission);
  }
  pw.println(prefix + "String_Node_Str" + processName);
  pw.println(prefix + "String_Node_Str" + taskAffinity);
  pw.println(prefix + "String_Node_Str" + uid+ "String_Node_Str"+ Integer.toHexString(flags)+ "String_Node_Str"+ Integer.toHexString(theme));
  pw.println(prefix + "String_Node_Str" + sourceDir);
  if (sourceDir == null) {
    if (publicSourceDir != null) {
      pw.println(prefix + "String_Node_Str" + publicSourceDir);
    }
  }
 else   if (!sourceDir.equals(publicSourceDir)) {
    pw.println(prefix + "String_Node_Str" + publicSourceDir);
  }
  if (resourceDirs != null) {
    pw.println(prefix + "String_Node_Str" + resourceDirs);
  }
  pw.println(prefix + "String_Node_Str" + dataDir);
  if (sharedLibraryFiles != null) {
    pw.println(prefix + "String_Node_Str" + sharedLibraryFiles);
  }
  pw.println(prefix + "String_Node_Str" + enabled+ "String_Node_Str"+ targetSdkVersion);
  if (manageSpaceActivityName != null) {
    pw.println(prefix + "String_Node_Str" + manageSpaceActivityName);
  }
  if (descriptionRes != 0) {
    pw.println(prefix + "String_Node_Str" + Integer.toHexString(descriptionRes));
  }
  super.dumpBack(pw,prefix);
}
Program: 21851
Project: 21851
Buggy source:
public void dump(Printer pw,String prefix){
  super.dumpFront(pw,prefix);
  if (className != null) {
    pw.println(prefix + "String_Node_Str" + className);
  }
  if (permission != null) {
    pw.println(prefix + "String_Node_Str" + permission);
  }
  pw.println(prefix + "String_Node_Str" + processName);
  pw.println(prefix + "String_Node_Str" + taskAffinity);
  pw.println(prefix + "String_Node_Str" + uid+ "String_Node_Str"+ Integer.toHexString(flags)+ "String_Node_Str"+ Integer.toHexString(theme));
  pw.println(prefix + "String_Node_Str" + sourceDir);
  if (!sourceDir.equals(publicSourceDir)) {
    pw.println(prefix + "String_Node_Str" + publicSourceDir);
  }
  if (resourceDirs != null) {
    pw.println(prefix + "String_Node_Str" + resourceDirs);
  }
  pw.println(prefix + "String_Node_Str" + dataDir);
  if (sharedLibraryFiles != null) {
    pw.println(prefix + "String_Node_Str" + sharedLibraryFiles);
  }
  pw.println(prefix + "String_Node_Str" + enabled+ "String_Node_Str"+ targetSdkVersion);
  if (manageSpaceActivityName != null) {
    pw.println(prefix + "String_Node_Str" + manageSpaceActivityName);
  }
  if (descriptionRes != 0) {
    pw.println(prefix + "String_Node_Str" + Integer.toHexString(descriptionRes));
  }
  super.dumpBack(pw,prefix);
}

Fixed version (ground truth):
public void dump(Printer pw,String prefix){
  super.dumpFront(pw,prefix);
  if (className != null) {
    pw.println(prefix + "String_Node_Str" + className);
  }
  if (permission != null) {
    pw.println(prefix + "String_Node_Str" + permission);
  }
  pw.println(prefix + "String_Node_Str" + processName);
  pw.println(prefix + "String_Node_Str" + taskAffinity);
  pw.println(prefix + "String_Node_Str" + uid+ "String_Node_Str"+ Integer.toHexString(flags)+ "String_Node_Str"+ Integer.toHexString(theme));
  pw.println(prefix + "String_Node_Str" + sourceDir);
  if (sourceDir == null) {
    if (publicSourceDir != null) {
      pw.println(prefix + "String_Node_Str" + publicSourceDir);
    }
  }
 else   if (!sourceDir.equals(publicSourceDir)) {
    pw.println(prefix + "String_Node_Str" + publicSourceDir);
  }
  if (resourceDirs != null) {
    pw.println(prefix + "String_Node_Str" + resourceDirs);
  }
  pw.println(prefix + "String_Node_Str" + dataDir);
  if (sharedLibraryFiles != null) {
    pw.println(prefix + "String_Node_Str" + sharedLibraryFiles);
  }
  pw.println(prefix + "String_Node_Str" + enabled+ "String_Node_Str"+ targetSdkVersion);
  if (manageSpaceActivityName != null) {
    pw.println(prefix + "String_Node_Str" + manageSpaceActivityName);
  }
  if (descriptionRes != 0) {
    pw.println(prefix + "String_Node_Str" + Integer.toHexString(descriptionRes));
  }
  super.dumpBack(pw,prefix);
}
Program: 21852
Project: 21852
Buggy source:
/** 
 * @deprecated This functionality will be removed in the future; please donot use. Control whether this activity is required to be persistent.  By default activities are not persistent; setting this to true will prevent the system from stopping this activity or its process when running low on resources. <p><em>You should avoid using this method</em>, it has severe negative consequences on how well the system can manage its resources.  A better approach is to implement an application service that you control with {@link Context#startService} and {@link Context#stopService}.
 * @param isPersistent Control whether the current activity must bepersistent, true if so, false for the normal behavior.
 */
@Deprecated public void setPersistent(boolean isPersistent){
  if (mParent == null) {
    try {
      ActivityManagerNative.getDefault().setPersistent(mToken,isPersistent);
    }
 catch (    RemoteException e) {
    }
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @deprecated As of {@link android.os.Build.VERSION_CODES#GINGERBREAD}this is a no-op.
 */
@Deprecated public void setPersistent(boolean isPersistent){
}
Program: 21861
Project: 21861
Buggy source:
ProcessRecord(BatteryStatsImpl.Uid.Proc _batteryStats,IApplicationThread _thread,ApplicationInfo _info,String _processName){
  batteryStats=_batteryStats;
  info=_info;
  processName=_processName;
  pkgList.add(_info.packageName);
  thread=_thread;
  maxAdj=ActivityManagerService.EMPTY_APP_ADJ;
  hiddenAdj=ActivityManagerService.HIDDEN_APP_MIN_ADJ;
  curRawAdj=setRawAdj=-100;
  curAdj=setAdj=-100;
  persistent=false;
  removed=false;
  persistentActivities=0;
}

Fixed version (ground truth):
ProcessRecord(BatteryStatsImpl.Uid.Proc _batteryStats,IApplicationThread _thread,ApplicationInfo _info,String _processName){
  batteryStats=_batteryStats;
  info=_info;
  processName=_processName;
  pkgList.add(_info.packageName);
  thread=_thread;
  maxAdj=ActivityManagerService.EMPTY_APP_ADJ;
  hiddenAdj=ActivityManagerService.HIDDEN_APP_MIN_ADJ;
  curRawAdj=setRawAdj=-100;
  curAdj=setAdj=-100;
  persistent=false;
  removed=false;
}
Program: 21862
Project: 21862
Buggy source:
public HandleView(CursorController controller,Drawable handle){
  super(TextView.this.mContext);
  mController=controller;
  mDrawable=handle;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  mHotspotX=mDrawable.getIntrinsicWidth() * 0.5f;
  mHotspotY=-mDrawable.getIntrinsicHeight() * 0.2f;
}

Fixed version (ground truth):
public HandleView(CursorController controller,Drawable handle){
  super(TextView.this.mContext);
  mController=controller;
  mDrawable=handle;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  final int handleWidth=mDrawable.getIntrinsicWidth();
  final int handleHeight=mDrawable.getIntrinsicHeight();
  mHotspotX=handleWidth * 0.5f;
  mHotspotY=-handleHeight * 0.2f;
}
Program: 21863
Project: 21863
Buggy source:
private void moveTo(int x,int y){
  mPositionX=x - TextView.this.mScrollX;
  mPositionY=y - TextView.this.mScrollY;
  if (isPositionInBounds()) {
    if (mContainer.isShowing()) {
      final int[] coords=mTempCoords;
      TextView.this.getLocationInWindow(coords);
      coords[0]+=mPositionX;
      coords[1]+=mPositionY;
      mContainer.update(coords[0],coords[1],mRight - mLeft,mBottom - mTop);
    }
 else {
      show();
    }
  }
 else {
    hide();
  }
}

Fixed version (ground truth):
private void moveTo(int x,int y){
  mPositionX=x - TextView.this.mScrollX;
  mPositionY=y - TextView.this.mScrollY;
  if (isPositionVisible()) {
    int[] coords=null;
    if (mContainer.isShowing()) {
      coords=mTempCoords;
      TextView.this.getLocationInWindow(coords);
      mContainer.update(coords[0] + mPositionX,coords[1] + mPositionY,mRight - mLeft,mBottom - mTop);
    }
 else {
      show();
    }
    if (mIsDragging) {
      if (coords == null) {
        coords=mTempCoords;
        TextView.this.getLocationInWindow(coords);
      }
      if (coords[0] != mLastParentX || coords[1] != mLastParentY) {
        mOffsetX+=coords[0] - mLastParentX;
        mOffsetY+=coords[1] - mLastParentY;
        mLastParentX=coords[0];
        mLastParentY=coords[1];
      }
    }
  }
 else {
    hide();
  }
}
Program: 21864
Project: 21864
Buggy source:
private int getScrollRange(){
  int scrollRange=0;
  if (getChildCount() > 0) {
    View child=getChildAt(0);
    scrollRange=Math.max(0,child.getWidth() - getWidth() - mPaddingLeft- mPaddingRight);
  }
  return scrollRange;
}

Fixed version (ground truth):
private int getScrollRange(){
  int scrollRange=0;
  if (getChildCount() > 0) {
    View child=getChildAt(0);
    scrollRange=Math.max(0,child.getWidth() - (getWidth() - mPaddingLeft - mPaddingRight));
  }
  return scrollRange;
}
Program: 21866
Project: 21866
Buggy source:
private int getScrollRange(){
  int scrollRange=0;
  if (getChildCount() > 0) {
    View child=getChildAt(0);
    scrollRange=Math.max(0,child.getHeight() - getHeight() - mPaddingBottom- mPaddingTop);
  }
  return scrollRange;
}

Fixed version (ground truth):
private int getScrollRange(){
  int scrollRange=0;
  if (getChildCount() > 0) {
    View child=getChildAt(0);
    scrollRange=Math.max(0,child.getHeight() - (getHeight() - mPaddingBottom - mPaddingTop));
  }
  return scrollRange;
}
Program: 21868
Project: 21868
Buggy source:
private int getScrollRange(){
  int scrollRange=0;
  if (getChildCount() > 0) {
    View child=getChildAt(0);
    scrollRange=Math.max(0,child.getWidth() - getWidth() - mPaddingLeft- mPaddingRight);
  }
  return scrollRange;
}

Fixed version (ground truth):
private int getScrollRange(){
  int scrollRange=0;
  if (getChildCount() > 0) {
    View child=getChildAt(0);
    scrollRange=Math.max(0,child.getWidth() - (getWidth() - mPaddingLeft - mPaddingRight));
  }
  return scrollRange;
}
Program: 21870
Project: 21870
Buggy source:
private int getScrollRange(){
  int scrollRange=0;
  if (getChildCount() > 0) {
    View child=getChildAt(0);
    scrollRange=Math.max(0,child.getHeight() - getHeight() - mPaddingBottom- mPaddingTop);
  }
  return scrollRange;
}

Fixed version (ground truth):
private int getScrollRange(){
  int scrollRange=0;
  if (getChildCount() > 0) {
    View child=getChildAt(0);
    scrollRange=Math.max(0,child.getHeight() - (getHeight() - mPaddingBottom - mPaddingTop));
  }
  return scrollRange;
}
Program: 21872
Project: 21872
Buggy source:
public HandleView(CursorController controller,Drawable handle){
  super(TextView.this.mContext);
  mController=controller;
  mDrawable=handle;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  mContainer.setLayoutInScreenEnabled(true);
}

Fixed version (ground truth):
public HandleView(CursorController controller,Drawable handle){
  super(TextView.this.mContext);
  mController=controller;
  mDrawable=handle;
  mContainer=new PopupWindow(TextView.this.mContext,null,com.android.internal.R.attr.textSelectHandleWindowStyle);
  mContainer.setSplitTouchEnabled(true);
  mContainer.setClippingEnabled(false);
  mHotspotX=mDrawable.getIntrinsicWidth() * 0.5f;
  mHotspotY=-mDrawable.getIntrinsicHeight() * 0.2f;
}
Program: 21873
Project: 21873
Buggy source:
private void moveTo(int x,int y){
  mPositionX=x - TextView.this.mScrollX;
  mPositionY=y - TextView.this.mScrollY;
  if (isPositionInBounds()) {
    if (mContainer.isShowing()) {
      final int[] coords=mTempCoords;
      TextView.this.getLocationOnScreen(coords);
      coords[0]+=mPositionX;
      coords[1]+=mPositionY;
      mContainer.update(coords[0],coords[1],mRight - mLeft,mBottom - mTop);
    }
 else {
      show();
    }
  }
 else {
    hide();
  }
}

Fixed version (ground truth):
private void moveTo(int x,int y){
  mPositionX=x - TextView.this.mScrollX;
  mPositionY=y - TextView.this.mScrollY;
  if (isPositionInBounds()) {
    if (mContainer.isShowing()) {
      final int[] coords=mTempCoords;
      TextView.this.getLocationInWindow(coords);
      coords[0]+=mPositionX;
      coords[1]+=mPositionY;
      mContainer.update(coords[0],coords[1],mRight - mLeft,mBottom - mTop);
    }
 else {
      show();
    }
  }
 else {
    hide();
  }
}
Program: 21874
Project: 21874
Buggy source:
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  mTemporaryDetach=false;
  if (mShowErrorAfterAttach) {
    showError();
    mShowErrorAfterAttach=false;
  }
}

Fixed version (ground truth):
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  mTemporaryDetach=false;
  if (mShowErrorAfterAttach) {
    showError();
    mShowErrorAfterAttach=false;
  }
  final ViewTreeObserver observer=getViewTreeObserver();
  if (observer != null) {
    if (mInsertionPointCursorController != null) {
      observer.addOnTouchModeChangeListener(mInsertionPointCursorController);
    }
    if (mSelectionModifierCursorController != null) {
      observer.addOnTouchModeChangeListener(mSelectionModifierCursorController);
    }
  }
}
Program: 21875
Project: 21875
Buggy source:
@Override protected void onVisibilityChanged(View changedView,int visibility){
  super.onVisibilityChanged(changedView,visibility);
  if (visibility != VISIBLE) {
    hideControllers();
  }
}

Fixed version (ground truth):
@Override protected void onVisibilityChanged(View changedView,int visibility){
  super.onVisibilityChanged(changedView,visibility);
  if (visibility != VISIBLE) {
    hideInsertionPointCursorController();
    if (mSelectionModifierCursorController != null) {
      mSelectionModifierCursorController.hide();
    }
  }
}
Program: 21876
Project: 21876
Buggy source:
private void onTapUpEvent(int prevStart,int prevEnd){
  final int start=getSelectionStart();
  final int end=getSelectionEnd();
  if (start == end) {
    if (start >= prevStart && start < prevEnd) {
      Selection.setSelection((Spannable)mText,prevStart,prevEnd);
      showContextMenu();
      return;
    }
 else {
      stopTextSelectionMode();
      if (mInsertionPointCursorController != null) {
        mInsertionPointCursorController.show();
      }
    }
  }
}

Fixed version (ground truth):
private void onTapUpEvent(int prevStart,int prevEnd){
  final int start=getSelectionStart();
  final int end=getSelectionEnd();
  if (start == end) {
    if (start >= prevStart && start < prevEnd) {
      Selection.setSelection((Spannable)mText,prevStart,prevEnd);
      if (mSelectionModifierCursorController != null && !mSelectionModifierCursorController.isShowing()) {
        mSelectionModifierCursorController.show();
      }
 else {
        showContextMenu();
      }
      return;
    }
 else {
      stopTextSelectionMode();
      if (mInsertionPointCursorController != null) {
        mInsertionPointCursorController.show();
      }
    }
  }
 else   if (hasSelection() && mSelectionModifierCursorController != null) {
    mSelectionModifierCursorController.show();
  }
}
Program: 21877
Project: 21877
Buggy source:
public void show(){
  mIsShowing=true;
  updatePosition();
  mStartHandle.show();
  mEndHandle.show();
  hideInsertionPointCursorController();
}

Fixed version (ground truth):
public void show(){
  mIsShowing=true;
  updatePosition();
  mStartHandle.show();
  mEndHandle.show();
  hideInsertionPointCursorController();
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}
Program: 21878
Project: 21878
Buggy source:
private void hideDelayed(int msec){
  TextView.this.removeCallbacks(mHider);
  TextView.this.postDelayed(mHider,msec);
}

Fixed version (ground truth):
private void hideDelayed(int delay){
  removeCallbacks(mHider);
  postDelayed(mHider,delay);
}
Program: 21879
Project: 21879
Buggy source:
public void updatePosition(){
  final int selectionStart=getSelectionStart();
  final int selectionEnd=getSelectionEnd();
  if ((selectionStart < 0) || (selectionEnd < 0)) {
    Log.w(LOG_TAG,"String_Node_Str");
    hide();
    return;
  }
  boolean oneLineSelection=mLayout.getLineForOffset(selectionStart) == mLayout.getLineForOffset(selectionEnd);
  mStartHandle.positionAtCursor(selectionStart,oneLineSelection);
  mEndHandle.positionAtCursor(selectionEnd,true);
}

Fixed version (ground truth):
public void updatePosition(){
  final int selectionStart=getSelectionStart();
  final int selectionEnd=getSelectionEnd();
  if ((selectionStart < 0) || (selectionEnd < 0)) {
    Log.w(LOG_TAG,"String_Node_Str");
    hide();
    return;
  }
  boolean oneLineSelection=mLayout.getLineForOffset(selectionStart) == mLayout.getLineForOffset(selectionEnd);
  mStartHandle.positionAtCursor(selectionStart,oneLineSelection);
  mEndHandle.positionAtCursor(selectionEnd,true);
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}
Program: 21880
Project: 21880
Buggy source:
public void hide(){
  mStartHandle.hide();
  mEndHandle.hide();
  mIsShowing=false;
}

Fixed version (ground truth):
public void hide(){
  mStartHandle.hide();
  mEndHandle.hide();
  mIsShowing=false;
  removeCallbacks(mHider);
}
Program: 21881
Project: 21881
Buggy source:
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  if (hasWindowFocus) {
    if (mBlink != null) {
      mBlink.uncancel();
      if (isFocused()) {
        mShowCursor=SystemClock.uptimeMillis();
        makeBlink();
      }
    }
  }
 else {
    if (mBlink != null) {
      mBlink.cancel();
    }
    onEndBatchEdit();
    if (mInputContentType != null) {
      mInputContentType.enterDown=false;
    }
    hideControllers();
  }
  startStopMarquee(hasWindowFocus);
}

Fixed version (ground truth):
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  if (hasWindowFocus) {
    if (mBlink != null) {
      mBlink.uncancel();
      if (isFocused()) {
        mShowCursor=SystemClock.uptimeMillis();
        makeBlink();
      }
    }
  }
 else {
    if (mBlink != null) {
      mBlink.cancel();
    }
    onEndBatchEdit();
    if (mInputContentType != null) {
      mInputContentType.enterDown=false;
    }
    hideInsertionPointCursorController();
    if (mSelectionModifierCursorController != null) {
      mSelectionModifierCursorController.hide();
    }
  }
  startStopMarquee(hasWindowFocus);
}
Program: 21882
Project: 21882
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  if (mPreDrawState != PREDRAW_NOT_REGISTERED) {
    final ViewTreeObserver observer=getViewTreeObserver();
    if (observer != null) {
      observer.removeOnPreDrawListener(this);
      mPreDrawState=PREDRAW_NOT_REGISTERED;
    }
  }
  if (mError != null) {
    hideError();
  }
  hideControllers();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  final ViewTreeObserver observer=getViewTreeObserver();
  if (observer != null) {
    if (mPreDrawState != PREDRAW_NOT_REGISTERED) {
      observer.removeOnPreDrawListener(this);
      mPreDrawState=PREDRAW_NOT_REGISTERED;
    }
    if (mInsertionPointCursorController != null) {
      observer.removeOnTouchModeChangeListener(mInsertionPointCursorController);
    }
    if (mSelectionModifierCursorController != null) {
      observer.removeOnTouchModeChangeListener(mSelectionModifierCursorController);
    }
  }
  if (mError != null) {
    hideError();
  }
  hideControllers();
}
Program: 21884
Project: 21884
Buggy source:
@Override public boolean onKeyShortcut(int keyCode,KeyEvent event){
switch (keyCode) {
case KeyEvent.KEYCODE_A:
    if (canSelectAll()) {
      return onTextContextMenuItem(ID_SELECT_ALL);
    }
  break;
case KeyEvent.KEYCODE_X:
if (canCut()) {
  return onTextContextMenuItem(ID_CUT);
}
break;
case KeyEvent.KEYCODE_C:
if (canCopy()) {
return onTextContextMenuItem(ID_COPY);
}
break;
case KeyEvent.KEYCODE_V:
if (canPaste()) {
return onTextContextMenuItem(ID_PASTE);
}
break;
}
return super.onKeyShortcut(keyCode,event);
}

Fixed version (ground truth):
@Override public boolean onKeyShortcut(int keyCode,KeyEvent event){
switch (keyCode) {
case KeyEvent.KEYCODE_A:
    if (canSelectText()) {
      return onTextContextMenuItem(ID_SELECT_ALL);
    }
  break;
case KeyEvent.KEYCODE_X:
if (canCut()) {
  return onTextContextMenuItem(ID_CUT);
}
break;
case KeyEvent.KEYCODE_C:
if (canCopy()) {
return onTextContextMenuItem(ID_COPY);
}
break;
case KeyEvent.KEYCODE_V:
if (canPaste()) {
return onTextContextMenuItem(ID_PASTE);
}
break;
}
return super.onKeyShortcut(keyCode,event);
}
Program: 21885
Project: 21885
Buggy source:
private void prepareCursorControllers(){
  if (mCursorVisible && mLayout != null) {
    if (mInsertionPointCursorController == null) {
      mInsertionPointCursorController=new InsertionPointCursorController();
    }
  }
 else {
    mInsertionPointCursorController=null;
  }
  if (canSelectText() && mLayout != null) {
    if (mSelectionModifierCursorController == null) {
      mSelectionModifierCursorController=new SelectionModifierCursorController();
    }
  }
 else {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}

Fixed version (ground truth):
private void prepareCursorControllers(){
  if (mCursorVisible && mLayout != null) {
    if (mInsertionPointCursorController == null) {
      mInsertionPointCursorController=new InsertionPointCursorController();
    }
  }
 else {
    mInsertionPointCursorController=null;
  }
  if (textCanBeSelected() && mLayout != null) {
    if (mSelectionModifierCursorController == null) {
      mSelectionModifierCursorController=new SelectionModifierCursorController();
    }
  }
 else {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}
Program: 21886
Project: 21886
Buggy source:
private boolean canSelectText(){
  return (mText instanceof Spannable && mMovement != null && mMovement.canSelectArbitrarily());
}

Fixed version (ground truth):
private boolean canSelectText(){
  return textCanBeSelected() && mText.length() != 0;
}
Program: 21889
Project: 21889
Buggy source:
/** 
 * Set the range of numbers allowed for the number picker. The current value will be automatically set to the start. Also provide a mapping for values used to display to the user.
 * @param start the start of the range (inclusive)
 * @param end the end of the range (inclusive)
 * @param displayedValues the values displayed to the user.
 */
public void setRange(int start,int end,String[] displayedValues){
  mDisplayedValues=displayedValues;
  mStart=start;
  mEnd=end;
  mCurrent=start;
  updateView();
}

Fixed version (ground truth):
/** 
 * Set the range of numbers allowed for the number picker. The current value will be automatically set to the start. Also provide a mapping for values used to display to the user.
 * @param start the start of the range (inclusive)
 * @param end the end of the range (inclusive)
 * @param displayedValues the values displayed to the user.
 */
public void setRange(int start,int end,String[] displayedValues){
  mDisplayedValues=displayedValues;
  mStart=start;
  mEnd=end;
  mCurrent=start;
  updateView();
  if (displayedValues != null) {
    mText.setRawInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
  }
}
Program: 21891
Project: 21891
Buggy source:
@Override public boolean onKeyShortcut(int keyCode,KeyEvent event){
switch (keyCode) {
case KeyEvent.KEYCODE_A:
    if (canSelectAll()) {
      return onTextContextMenuItem(ID_SELECT_ALL);
    }
  break;
case KeyEvent.KEYCODE_X:
if (canCut()) {
  return onTextContextMenuItem(ID_CUT);
}
break;
case KeyEvent.KEYCODE_C:
if (canCopy()) {
return onTextContextMenuItem(ID_COPY);
}
break;
case KeyEvent.KEYCODE_V:
if (canPaste()) {
return onTextContextMenuItem(ID_PASTE);
}
break;
}
return super.onKeyShortcut(keyCode,event);
}

Fixed version (ground truth):
@Override public boolean onKeyShortcut(int keyCode,KeyEvent event){
switch (keyCode) {
case KeyEvent.KEYCODE_A:
    if (canSelectText()) {
      return onTextContextMenuItem(ID_SELECT_ALL);
    }
  break;
case KeyEvent.KEYCODE_X:
if (canCut()) {
  return onTextContextMenuItem(ID_CUT);
}
break;
case KeyEvent.KEYCODE_C:
if (canCopy()) {
return onTextContextMenuItem(ID_COPY);
}
break;
case KeyEvent.KEYCODE_V:
if (canPaste()) {
return onTextContextMenuItem(ID_PASTE);
}
break;
}
return super.onKeyShortcut(keyCode,event);
}
Program: 21892
Project: 21892
Buggy source:
private void prepareCursorControllers(){
  if (mCursorVisible && mLayout != null) {
    if (mInsertionPointCursorController == null) {
      mInsertionPointCursorController=new InsertionPointCursorController();
    }
  }
 else {
    mInsertionPointCursorController=null;
  }
  if (canSelectText() && mLayout != null) {
    if (mSelectionModifierCursorController == null) {
      mSelectionModifierCursorController=new SelectionModifierCursorController();
    }
  }
 else {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}

Fixed version (ground truth):
private void prepareCursorControllers(){
  if (mCursorVisible && mLayout != null) {
    if (mInsertionPointCursorController == null) {
      mInsertionPointCursorController=new InsertionPointCursorController();
    }
  }
 else {
    mInsertionPointCursorController=null;
  }
  if (textCanBeSelected() && mLayout != null) {
    if (mSelectionModifierCursorController == null) {
      mSelectionModifierCursorController=new SelectionModifierCursorController();
    }
  }
 else {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}
Program: 21893
Project: 21893
Buggy source:
private boolean canSelectText(){
  return (mText instanceof Spannable && mMovement != null && mMovement.canSelectArbitrarily());
}

Fixed version (ground truth):
private boolean canSelectText(){
  return textCanBeSelected() && mText.length() != 0;
}
Program: 21895
Project: 21895
Buggy source:
private void printRestoreSets(RestoreSet[] sets){
  for (  RestoreSet s : sets) {
    System.out.println("String_Node_Str" + Long.toHexString(s.token) + "String_Node_Str"+ s.name);
  }
}

Fixed version (ground truth):
private void printRestoreSets(RestoreSet[] sets){
  if (sets == null || sets.length == 0) {
    System.out.println("String_Node_Str");
    return;
  }
  for (  RestoreSet s : sets) {
    System.out.println("String_Node_Str" + Long.toHexString(s.token) + "String_Node_Str"+ s.name);
  }
}