nus-yam/ex-repair huggingface dataset:
Program: 41179
Project: 41179
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);
      if (mSelectionModifierCursorController != null && !mSelectionModifierCursorController.isShowing()) {
        mSelectionModifierCursorController.show();
      }
 else {
        showContextMenu();
      }
      return;
    }
 else {
      stopTextSelectionMode();
      if (mInsertionPointCursorController != null && mText.length() > 0) {
        mInsertionPointCursorController.show();
      }
    }
  }
 else   if (hasSelection() && mSelectionModifierCursorController != null) {
    mSelectionModifierCursorController.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 (hasSelectionController() && !getSelectionController().isShowing()) {
        getSelectionController().show();
      }
 else {
        showContextMenu();
      }
      return;
    }
 else {
      stopTextSelectionMode();
      if (hasInsertionController() && mText.length() > 0) {
        getInsertionController().show();
      }
    }
  }
 else   if (hasSelection() && hasSelectionController()) {
    getSelectionController().show();
  }
}
Program: 41180
Project: 41180
Buggy source:
public void show(){
  mIsShowing=true;
  updatePosition();
  mStartHandle.show();
  mEndHandle.show();
  hideInsertionPointCursorController();
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}

Fixed version (ground truth):
public void show(){
  if (isInBatchEditMode()) {
    return;
  }
  mIsShowing=true;
  updatePosition();
  mStartHandle.show();
  mEndHandle.show();
  hideInsertionPointCursorController();
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}
Program: 41181
Project: 41181
Buggy source:
public void endBatchEdit(){
  final InputMethodState ims=mInputMethodState;
  if (ims != null) {
    int nesting=--ims.mBatchEditNesting;
    if (nesting == 0) {
      finishBatchEdit(ims);
    }
  }
}

Fixed version (ground truth):
public void endBatchEdit(){
  mInBatchEditControllers=false;
  final InputMethodState ims=mInputMethodState;
  if (ims != null) {
    int nesting=--ims.mBatchEditNesting;
    if (nesting == 0) {
      finishBatchEdit(ims);
    }
  }
}
Program: 41182
Project: 41182
Buggy source:
private void prepareCursorControllers(){
  boolean windowSupportsHandles=false;
  ViewGroup.LayoutParams params=getRootView().getLayoutParams();
  if (params instanceof WindowManager.LayoutParams) {
    WindowManager.LayoutParams windowParams=(WindowManager.LayoutParams)params;
    windowSupportsHandles=windowParams.type < WindowManager.LayoutParams.FIRST_SUB_WINDOW || windowParams.type > WindowManager.LayoutParams.LAST_SUB_WINDOW;
  }
  if (windowSupportsHandles && mCursorVisible && mLayout != null) {
    if (mInsertionPointCursorController == null) {
      mInsertionPointCursorController=new InsertionPointCursorController();
    }
  }
 else {
    mInsertionPointCursorController=null;
  }
  if (windowSupportsHandles && textCanBeSelected() && mLayout != null) {
    if (mSelectionModifierCursorController == null) {
      mSelectionModifierCursorController=new SelectionModifierCursorController();
    }
  }
 else {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}

Fixed version (ground truth):
private void prepareCursorControllers(){
  boolean windowSupportsHandles=false;
  ViewGroup.LayoutParams params=getRootView().getLayoutParams();
  if (params instanceof WindowManager.LayoutParams) {
    WindowManager.LayoutParams windowParams=(WindowManager.LayoutParams)params;
    windowSupportsHandles=windowParams.type < WindowManager.LayoutParams.FIRST_SUB_WINDOW || windowParams.type > WindowManager.LayoutParams.LAST_SUB_WINDOW;
  }
  mInsertionControllerEnabled=windowSupportsHandles && mCursorVisible && mLayout != null;
  mSelectionControllerEnabled=windowSupportsHandles && textCanBeSelected() && mLayout != null;
  if (!mInsertionControllerEnabled) {
    mInsertionPointCursorController=null;
  }
  if (!mSelectionControllerEnabled) {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}
Program: 41183
Project: 41183
Buggy source:
/** 
 * {@inheritDoc}
 */
public boolean onPreDraw(){
  if (mPreDrawState != PREDRAW_PENDING) {
    return true;
  }
  if (mLayout == null) {
    assumeLayout();
  }
  boolean changed=false;
  SelectionModifierCursorController selectionController=null;
  if (mSelectionModifierCursorController != null) {
    selectionController=(SelectionModifierCursorController)mSelectionModifierCursorController;
  }
  if (mMovement != null) {
    int curs=getSelectionEnd();
    if (selectionController != null && selectionController.isSelectionStartDragged()) {
      curs=getSelectionStart();
    }
    if (curs < 0 && (mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
      curs=mText.length();
    }
    if (curs >= 0) {
      changed=bringPointIntoView(curs);
    }
  }
 else {
    changed=bringTextIntoView();
  }
  if (selectionController != null && hasSelection()) {
    startTextSelectionMode();
  }
  mPreDrawState=PREDRAW_DONE;
  return !changed;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public boolean onPreDraw(){
  if (mPreDrawState != PREDRAW_PENDING) {
    return true;
  }
  if (mLayout == null) {
    assumeLayout();
  }
  boolean changed=false;
  SelectionModifierCursorController selectionController=null;
  if (mSelectionModifierCursorController != null) {
    selectionController=(SelectionModifierCursorController)mSelectionModifierCursorController;
  }
  if (mMovement != null) {
    int curs=getSelectionEnd();
    if (selectionController != null && selectionController.isSelectionStartDragged()) {
      curs=getSelectionStart();
    }
    if (curs < 0 && (mGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
      curs=mText.length();
    }
    if (curs >= 0) {
      changed=bringPointIntoView(curs);
    }
  }
 else {
    changed=bringTextIntoView();
  }
  if (this instanceof ExtractEditText && selectionController != null && hasSelection()) {
    startTextSelectionMode();
  }
  mPreDrawState=PREDRAW_DONE;
  return !changed;
}
Program: 41184
Project: 41184
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;
  }
  mStartHandle.positionAtCursor(selectionStart,true);
  mEndHandle.positionAtCursor(selectionEnd,true);
  hideDelayed(DELAY_BEFORE_FADE_OUT);
}

Fixed version (ground truth):
public void updatePosition(){
  if (!isShowing()) {
    return;
  }
  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: 41185
Project: 41185
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 + (int)mHotspotY;
  return posX >= clip.left && posX <= clip.right && posY >= clip.top && posY <= clip.bottom;
}

Fixed version (ground truth):
private boolean isPositionVisible(){
  if (mIsDragging) {
    return true;
  }
  if (isInBatchEditMode()) {
    return false;
  }
  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: 41188
Project: 41188
Buggy source:
/** 
 * Called when the application is stopping.  There are no more application objects running and the process will exit.  <em>Note: never depend on this method being called; in many cases an unneeded application process will simply be killed by the kernel without executing any application code.</em> If you override this method, be sure to call super.onTerminate().
 */
public void onTerminate(){
}

Fixed version (ground truth):
/** 
 * This method is for use in emulated process environments.  It will never be called on a production Android device, where processes are removed by simply killing them; no user code (including this callback) is executed when doing so.
 */
public void onTerminate(){
}
Program: 41189
Project: 41189
Buggy source:
/** 
 * Called when the application is stopping.  There are no more application objects running and the process will exit.  <em>Note: never depend on this method being called; in many cases an unneeded application process will simply be killed by the kernel without executing any application code.</em> If you override this method, be sure to call super.onTerminate().
 */
public void onTerminate(){
}

Fixed version (ground truth):
/** 
 * This method is for use in emulated process environments.  It will never be called on a production Android device, where processes are removed by simply killing them; no user code (including this callback) is executed when doing so.
 */
public void onTerminate(){
}
Program: 41190
Project: 41190
Buggy source:
/** 
 * Resolves the value of a resource, if the value references a theme or resource value. <p/> This method ensures that it returns a   {@link IResourceValue} object that does notreference another resource. If the resource cannot be resolved, it returns <code>null</code>. <p/> If a value that does not need to be resolved is given, the method will return a new instance of IResourceValue that contains the input value.
 * @param type the type of the resource
 * @param name the name of the attribute containing this value.
 * @param value the resource value, or reference to resolve
 * @return the resolved resource value or <code>null</code> if it failed to resolve it.
 */
private IResourceValue resolveValue(String type,String name,String value){
  if (value == null) {
    return null;
  }
  IResourceValue resValue=findResValue(value);
  if (resValue == null) {
    return new ResourceValue(type,name,value);
  }
  return resolveResValue(resValue);
}

Fixed version (ground truth):
/** 
 * Resolves the value of a resource, if the value references a theme or resource value. <p/> This method ensures that it returns a   {@link IResourceValue} object that does notreference another resource. If the resource cannot be resolved, it returns <code>null</code>. <p/> If a value that does not need to be resolved is given, the method will return a new instance of IResourceValue that contains the input value.
 * @param type the type of the resource
 * @param name the name of the attribute containing this value.
 * @param value the resource value, or reference to resolve
 * @return the resolved resource value or <code>null</code> if it failed to resolve it.
 */
private IResourceValue resolveValue(String type,String name,String value){
  if (value == null) {
    return null;
  }
  IResourceValue resValue=findResValue(value,false);
  if (resValue == null) {
    return new ResourceValue(type,name,value);
  }
  return resolveResValue(resValue);
}
Program: 41192
Project: 41192
Buggy source:
/** 
 * Returns the   {@link IResourceValue} referenced by the value of <var>value</var>.<p/> This method ensures that it returns a  {@link IResourceValue} object that does notreference another resource. If the resource cannot be resolved, it returns <code>null</code>. <p/> If a value that does not need to be resolved is given, the method will return the input value.
 * @param value the value containing the reference to resolve.
 * @return a {@link IResourceValue} object or <code>null</code>
 */
IResourceValue resolveResValue(IResourceValue value){
  if (value == null) {
    return null;
  }
  if (value instanceof IStyleResourceValue) {
    return value;
  }
  IResourceValue resolvedValue=findResValue(value.getValue());
  if (resolvedValue == null) {
    return value;
  }
  return resolveResValue(resolvedValue);
}

Fixed version (ground truth):
/** 
 * Returns the   {@link IResourceValue} referenced by the value of <var>value</var>.<p/> This method ensures that it returns a  {@link IResourceValue} object that does notreference another resource. If the resource cannot be resolved, it returns <code>null</code>. <p/> If a value that does not need to be resolved is given, the method will return the input value.
 * @param value the value containing the reference to resolve.
 * @return a {@link IResourceValue} object or <code>null</code>
 */
IResourceValue resolveResValue(IResourceValue value){
  if (value == null) {
    return null;
  }
  if (value instanceof IStyleResourceValue) {
    return value;
  }
  IResourceValue resolvedValue=findResValue(value.getValue(),value.isFramework());
  if (resolvedValue == null) {
    return value;
  }
  return resolveResValue(resolvedValue);
}
Program: 41193
Project: 41193
Buggy source:
private int resolveResourceValue(String value,int defaultValue){
  IResourceValue resource=mContext.resolveResValue(mContext.findResValue(value));
  if (resource != null) {
    Integer id=null;
    if (mPlatformFile || resource.isFramework()) {
      id=Bridge.getResourceValue(resource.getType(),resource.getName());
    }
 else {
      id=mContext.getProjectCallback().getResourceValue(resource.getType(),resource.getName());
    }
    if (id != null) {
      return id;
    }
  }
  return defaultValue;
}

Fixed version (ground truth):
private int resolveResourceValue(String value,int defaultValue){
  IResourceValue resource=mContext.resolveResValue(mContext.findResValue(value,mPlatformFile));
  if (resource != null) {
    Integer id=null;
    if (mPlatformFile || resource.isFramework()) {
      id=Bridge.getResourceValue(resource.getType(),resource.getName());
    }
 else {
      id=mContext.getProjectCallback().getResourceValue(resource.getType(),resource.getName());
    }
    if (id != null) {
      return id;
    }
  }
  return defaultValue;
}
Program: 41196
Project: 41196
Buggy source:
private final void handlePauseActivity(IBinder token,boolean finished,boolean userLeaving,int configChanges){
  ActivityClientRecord r=mActivities.get(token);
  if (r != null) {
    if (userLeaving) {
      performUserLeavingActivity(r);
    }
    r.activity.mConfigChangeFlags|=configChanges;
    Bundle state=performPauseActivity(token,finished,true);
    try {
      ActivityManagerNative.getDefault().activityPaused(token,state);
    }
 catch (    RemoteException ex) {
    }
  }
}

Fixed version (ground truth):
private final void handlePauseActivity(IBinder token,boolean finished,boolean userLeaving,int configChanges){
  ActivityClientRecord r=mActivities.get(token);
  if (r != null) {
    if (userLeaving) {
      performUserLeavingActivity(r);
    }
    r.activity.mConfigChangeFlags|=configChanges;
    Bundle state=performPauseActivity(token,finished,true);
    QueuedWork.waitToFinish();
    try {
      ActivityManagerNative.getDefault().activityPaused(token,state);
    }
 catch (    RemoteException ex) {
    }
  }
}
Program: 41197
Project: 41197
Buggy source:
/** 
 * Resolves the value of a resource, if the value references a theme or resource value. <p/> This method ensures that it returns a   {@link IResourceValue} object that does notreference another resource. If the resource cannot be resolved, it returns <code>null</code>. <p/> If a value that does not need to be resolved is given, the method will return a new instance of IResourceValue that contains the input value.
 * @param type the type of the resource
 * @param name the name of the attribute containing this value.
 * @param value the resource value, or reference to resolve
 * @return the resolved resource value or <code>null</code> if it failed to resolve it.
 */
private IResourceValue resolveValue(String type,String name,String value){
  if (value == null) {
    return null;
  }
  IResourceValue resValue=findResValue(value);
  if (resValue == null) {
    return new ResourceValue(type,name,value);
  }
  return resolveResValue(resValue);
}

Fixed version (ground truth):
/** 
 * Resolves the value of a resource, if the value references a theme or resource value. <p/> This method ensures that it returns a   {@link IResourceValue} object that does notreference another resource. If the resource cannot be resolved, it returns <code>null</code>. <p/> If a value that does not need to be resolved is given, the method will return a new instance of IResourceValue that contains the input value.
 * @param type the type of the resource
 * @param name the name of the attribute containing this value.
 * @param value the resource value, or reference to resolve
 * @return the resolved resource value or <code>null</code> if it failed to resolve it.
 */
private IResourceValue resolveValue(String type,String name,String value){
  if (value == null) {
    return null;
  }
  IResourceValue resValue=findResValue(value,false);
  if (resValue == null) {
    return new ResourceValue(type,name,value);
  }
  return resolveResValue(resValue);
}
Program: 41199
Project: 41199
Buggy source:
/** 
 * Returns the   {@link IResourceValue} referenced by the value of <var>value</var>.<p/> This method ensures that it returns a  {@link IResourceValue} object that does notreference another resource. If the resource cannot be resolved, it returns <code>null</code>. <p/> If a value that does not need to be resolved is given, the method will return the input value.
 * @param value the value containing the reference to resolve.
 * @return a {@link IResourceValue} object or <code>null</code>
 */
IResourceValue resolveResValue(IResourceValue value){
  if (value == null) {
    return null;
  }
  if (value instanceof IStyleResourceValue) {
    return value;
  }
  IResourceValue resolvedValue=findResValue(value.getValue());
  if (resolvedValue == null) {
    return value;
  }
  return resolveResValue(resolvedValue);
}

Fixed version (ground truth):
/** 
 * Returns the   {@link IResourceValue} referenced by the value of <var>value</var>.<p/> This method ensures that it returns a  {@link IResourceValue} object that does notreference another resource. If the resource cannot be resolved, it returns <code>null</code>. <p/> If a value that does not need to be resolved is given, the method will return the input value.
 * @param value the value containing the reference to resolve.
 * @return a {@link IResourceValue} object or <code>null</code>
 */
IResourceValue resolveResValue(IResourceValue value){
  if (value == null) {
    return null;
  }
  if (value instanceof IStyleResourceValue) {
    return value;
  }
  IResourceValue resolvedValue=findResValue(value.getValue(),value.isFramework());
  if (resolvedValue == null) {
    return value;
  }
  return resolveResValue(resolvedValue);
}
Program: 41200
Project: 41200
Buggy source:
private int resolveResourceValue(String value,int defaultValue){
  IResourceValue resource=mContext.resolveResValue(mContext.findResValue(value));
  if (resource != null) {
    Integer id=null;
    if (mPlatformFile || resource.isFramework()) {
      id=Bridge.getResourceValue(resource.getType(),resource.getName());
    }
 else {
      id=mContext.getProjectCallback().getResourceValue(resource.getType(),resource.getName());
    }
    if (id != null) {
      return id;
    }
  }
  return defaultValue;
}

Fixed version (ground truth):
private int resolveResourceValue(String value,int defaultValue){
  IResourceValue resource=mContext.resolveResValue(mContext.findResValue(value,mPlatformFile));
  if (resource != null) {
    Integer id=null;
    if (mPlatformFile || resource.isFramework()) {
      id=Bridge.getResourceValue(resource.getType(),resource.getName());
    }
 else {
      id=mContext.getProjectCallback().getResourceValue(resource.getType(),resource.getName());
    }
    if (id != null) {
      return id;
    }
  }
  return defaultValue;
}
Program: 41202
Project: 41202
Buggy source:
public void setAudioMode(){
  Context context=getContext();
  if (context == null)   return;
  AudioManager audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  int mode=AudioManager.MODE_NORMAL;
switch (getState()) {
case RINGING:
    mode=AudioManager.MODE_RINGTONE;
  break;
case OFFHOOK:
Phone fgPhone=getFgPhone();
if (!(fgPhone instanceof SipPhone)) {
mode=AudioManager.MODE_IN_CALL;
}
break;
}
if (audioManager.getMode() != mode) audioManager.setMode(mode);
}

Fixed version (ground truth):
public void setAudioMode(){
  Context context=getContext();
  if (context == null)   return;
  AudioManager audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  int mode=AudioManager.MODE_NORMAL;
switch (getState()) {
case RINGING:
    mode=AudioManager.MODE_RINGTONE;
  break;
case OFFHOOK:
Phone fgPhone=getFgPhone();
if (hasActiveFgCall() && !(fgPhone instanceof SipPhone)) {
mode=AudioManager.MODE_IN_CALL;
}
break;
}
if (audioManager.getMode() != mode) audioManager.setMode(mode);
}
Program: 41203
Project: 41203
Buggy source:
public void setAudioMode(){
  Context context=getContext();
  if (context == null)   return;
  AudioManager audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  int mode=AudioManager.MODE_NORMAL;
switch (getState()) {
case RINGING:
    mode=AudioManager.MODE_RINGTONE;
  break;
case OFFHOOK:
Phone fgPhone=getFgPhone();
if (!(fgPhone instanceof SipPhone)) {
mode=AudioManager.MODE_IN_CALL;
}
break;
}
if (audioManager.getMode() != mode) audioManager.setMode(mode);
}

Fixed version (ground truth):
public void setAudioMode(){
  Context context=getContext();
  if (context == null)   return;
  AudioManager audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  int mode=AudioManager.MODE_NORMAL;
switch (getState()) {
case RINGING:
    mode=AudioManager.MODE_RINGTONE;
  break;
case OFFHOOK:
Phone fgPhone=getFgPhone();
if (hasActiveFgCall() && !(fgPhone instanceof SipPhone)) {
mode=AudioManager.MODE_IN_CALL;
}
break;
}
if (audioManager.getMode() != mode) audioManager.setMode(mode);
}
Program: 41204
Project: 41204
Buggy source:
/** 
 * {@inheritDoc}
 */
public void onClick(DialogInterface dialog,int which){
  if (which == POSITIVE_BUTTON) {
    IMountService mountService=IMountService.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
    if (mountService != null) {
      try {
        mountService.formatVolume(Environment.getExternalStorageDirectory().toString());
      }
 catch (      RemoteException e) {
      }
    }
  }
  finish();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void onClick(DialogInterface dialog,int which){
  if (which == POSITIVE_BUTTON) {
    Intent intent=new Intent(ExternalStorageFormatter.FORMAT_ONLY);
    intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME);
    startService(intent);
  }
  finish();
}
Program: 41205
Project: 41205
Buggy source:
/** 
 * {@inheritDoc}
 */
public void onClick(DialogInterface dialog,int which){
  if (which == POSITIVE_BUTTON) {
    IMountService mountService=IMountService.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
    if (mountService != null) {
      try {
        mountService.formatVolume(Environment.getExternalStorageDirectory().toString());
      }
 catch (      RemoteException e) {
      }
    }
  }
  finish();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void onClick(DialogInterface dialog,int which){
  if (which == POSITIVE_BUTTON) {
    Intent intent=new Intent(ExternalStorageFormatter.FORMAT_ONLY);
    intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME);
    startService(intent);
  }
  finish();
}
Program: 41213
Project: 41213
Buggy source:
private void doDrag(int deltaX,int deltaY){
  if ((deltaX | deltaY) != 0) {
    final int oldX=mScrollX;
    final int oldY=mScrollY;
    final int rangeX=computeMaxScrollX();
    final int rangeY=computeMaxScrollY();
    if (mEdgeGlowTop != null) {
      mOverscrollDeltaX=deltaX;
      mOverscrollDeltaY=deltaY;
    }
    overScrollBy(deltaX,deltaY,oldX,oldY,rangeX,rangeY,mOverscrollDistance,mOverscrollDistance,true);
  }
  if (!getSettings().getBuiltInZoomControls()) {
    boolean showPlusMinus=mMinZoomScale < mMaxZoomScale;
    if (mZoomControls != null && showPlusMinus) {
      if (mZoomControls.getVisibility() == View.VISIBLE) {
        mPrivateHandler.removeCallbacks(mZoomControlRunnable);
      }
 else {
        mZoomControls.show(showPlusMinus,false);
      }
      mPrivateHandler.postDelayed(mZoomControlRunnable,ZOOM_CONTROLS_TIMEOUT);
    }
  }
}

Fixed version (ground truth):
private void doDrag(int deltaX,int deltaY){
  if ((deltaX | deltaY) != 0) {
    final int oldX=mScrollX;
    final int oldY=mScrollY;
    final int rangeX=computeMaxScrollX();
    final int rangeY=computeMaxScrollY();
    if (mEdgeGlowTop != null) {
      mOverscrollDeltaX=deltaX;
      mOverscrollDeltaY=deltaY;
    }
    overScrollBy(deltaX,deltaY,oldX,oldY,rangeX,rangeY,mOverscrollDistance,mOverscrollDistance,true);
    if (mEdgeGlowTop != null && (!mEdgeGlowTop.isFinished() || !mEdgeGlowBottom.isFinished() || !mEdgeGlowLeft.isFinished()|| !mEdgeGlowRight.isFinished())) {
      invalidate();
    }
  }
  if (!getSettings().getBuiltInZoomControls()) {
    boolean showPlusMinus=mMinZoomScale < mMaxZoomScale;
    if (mZoomControls != null && showPlusMinus) {
      if (mZoomControls.getVisibility() == View.VISIBLE) {
        mPrivateHandler.removeCallbacks(mZoomControlRunnable);
      }
 else {
        mZoomControls.show(showPlusMinus,false);
      }
      mPrivateHandler.postDelayed(mZoomControlRunnable,ZOOM_CONTROLS_TIMEOUT);
    }
  }
}
Program: 41214
Project: 41214
Buggy source:
private void doDrag(int deltaX,int deltaY){
  if ((deltaX | deltaY) != 0) {
    final int oldX=mScrollX;
    final int oldY=mScrollY;
    final int rangeX=computeMaxScrollX();
    final int rangeY=computeMaxScrollY();
    if (mEdgeGlowTop != null) {
      mOverscrollDeltaX=deltaX;
      mOverscrollDeltaY=deltaY;
    }
    overScrollBy(deltaX,deltaY,oldX,oldY,rangeX,rangeY,mOverscrollDistance,mOverscrollDistance,true);
  }
  if (!getSettings().getBuiltInZoomControls()) {
    boolean showPlusMinus=mMinZoomScale < mMaxZoomScale;
    if (mZoomControls != null && showPlusMinus) {
      if (mZoomControls.getVisibility() == View.VISIBLE) {
        mPrivateHandler.removeCallbacks(mZoomControlRunnable);
      }
 else {
        mZoomControls.show(showPlusMinus,false);
      }
      mPrivateHandler.postDelayed(mZoomControlRunnable,ZOOM_CONTROLS_TIMEOUT);
    }
  }
}

Fixed version (ground truth):
private void doDrag(int deltaX,int deltaY){
  if ((deltaX | deltaY) != 0) {
    final int oldX=mScrollX;
    final int oldY=mScrollY;
    final int rangeX=computeMaxScrollX();
    final int rangeY=computeMaxScrollY();
    if (mEdgeGlowTop != null) {
      mOverscrollDeltaX=deltaX;
      mOverscrollDeltaY=deltaY;
    }
    overScrollBy(deltaX,deltaY,oldX,oldY,rangeX,rangeY,mOverscrollDistance,mOverscrollDistance,true);
    if (mEdgeGlowTop != null && (!mEdgeGlowTop.isFinished() || !mEdgeGlowBottom.isFinished() || !mEdgeGlowLeft.isFinished()|| !mEdgeGlowRight.isFinished())) {
      invalidate();
    }
  }
  if (!getSettings().getBuiltInZoomControls()) {
    boolean showPlusMinus=mMinZoomScale < mMaxZoomScale;
    if (mZoomControls != null && showPlusMinus) {
      if (mZoomControls.getVisibility() == View.VISIBLE) {
        mPrivateHandler.removeCallbacks(mZoomControlRunnable);
      }
 else {
        mZoomControls.show(showPlusMinus,false);
      }
      mPrivateHandler.postDelayed(mZoomControlRunnable,ZOOM_CONTROLS_TIMEOUT);
    }
  }
}
Program: 41219
Project: 41219
Buggy source:
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;
  }
}

Fixed version (ground truth):
private void prepareCursorControllers(){
  boolean windowSupportsHandles=false;
  ViewGroup.LayoutParams params=getRootView().getLayoutParams();
  if (params instanceof WindowManager.LayoutParams) {
    WindowManager.LayoutParams windowParams=(WindowManager.LayoutParams)params;
    windowSupportsHandles=windowParams.type < WindowManager.LayoutParams.FIRST_SUB_WINDOW || windowParams.type > WindowManager.LayoutParams.LAST_SUB_WINDOW;
  }
  if (windowSupportsHandles && mCursorVisible && mLayout != null) {
    if (mInsertionPointCursorController == null) {
      mInsertionPointCursorController=new InsertionPointCursorController();
    }
  }
 else {
    mInsertionPointCursorController=null;
  }
  if (windowSupportsHandles && textCanBeSelected() && mLayout != null) {
    if (mSelectionModifierCursorController == null) {
      mSelectionModifierCursorController=new SelectionModifierCursorController();
    }
  }
 else {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}
Program: 41220
Project: 41220
Buggy source:
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;
  }
}

Fixed version (ground truth):
private void prepareCursorControllers(){
  boolean windowSupportsHandles=false;
  ViewGroup.LayoutParams params=getRootView().getLayoutParams();
  if (params instanceof WindowManager.LayoutParams) {
    WindowManager.LayoutParams windowParams=(WindowManager.LayoutParams)params;
    windowSupportsHandles=windowParams.type < WindowManager.LayoutParams.FIRST_SUB_WINDOW || windowParams.type > WindowManager.LayoutParams.LAST_SUB_WINDOW;
  }
  if (windowSupportsHandles && mCursorVisible && mLayout != null) {
    if (mInsertionPointCursorController == null) {
      mInsertionPointCursorController=new InsertionPointCursorController();
    }
  }
 else {
    mInsertionPointCursorController=null;
  }
  if (windowSupportsHandles && textCanBeSelected() && mLayout != null) {
    if (mSelectionModifierCursorController == null) {
      mSelectionModifierCursorController=new SelectionModifierCursorController();
    }
  }
 else {
    stopTextSelectionMode();
    mSelectionModifierCursorController=null;
  }
}
Program: 41221
Project: 41221
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: 41222
Project: 41222
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: 41223
Project: 41223
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: 41224
Project: 41224
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: 41225
Project: 41225
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: 41226
Project: 41226
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: 41227
Project: 41227
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: 41228
Project: 41228
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: 41229
Project: 41229
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: 41230
Project: 41230
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: 41231
Project: 41231
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: 41232
Project: 41232
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: 41233
Project: 41233
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);
}