nus-yam/ex-repair huggingface dataset:
Program: 38238
Project: 38238
Buggy source:
public CountDownView(Context context,AttributeSet attrs){
  super(context,attrs);
  mContext=context;
  mCountDownAnim=AnimationUtils.loadAnimation(context,R.anim.count_down_exit);
  if (context.getResources().getBoolean(R.bool.force_count_down_sound)) {
    mSoundPool=new SoundPool(1,AudioManager.STREAM_SYSTEM_ENFORCED,0);
  }
 else {
    mSoundPool=new SoundPool(1,AudioManager.STREAM_NOTIFICATION,0);
  }
  mBeepOnce=mSoundPool.load(context,R.raw.beep_once,1);
  mBeepTwice=mSoundPool.load(context,R.raw.beep_twice,1);
}

Fixed version (ground truth):
public CountDownView(Context context,AttributeSet attrs){
  super(context,attrs);
  mContext=context;
  mCountDownAnim=AnimationUtils.loadAnimation(context,R.anim.count_down_exit);
  if (mSoundPool == null) {
    if (context.getResources().getBoolean(R.bool.force_count_down_sound)) {
      mSoundPool=new SoundPool(1,AudioManager.STREAM_SYSTEM_ENFORCED,0);
    }
 else {
      mSoundPool=new SoundPool(1,AudioManager.STREAM_NOTIFICATION,0);
    }
    mBeepOnce=mSoundPool.load(context,R.raw.beep_once,1);
    mBeepTwice=mSoundPool.load(context,R.raw.beep_twice,1);
  }
}
Program: 38239
Project: 38239
Buggy source:
public boolean isOverPreviewMenu(MotionEvent ev){
  if (mPreviewMenuStatus != PREVIEW_MENU_ON)   return false;
  if (mUI.getPreviewMenuLayout() == null)   return false;
  Rect rec=new Rect();
  mUI.getPreviewMenuLayout().getChildAt(0).getHitRect(rec);
  rec.top+=(int)mUI.getPreviewMenuLayout().getY();
  rec.bottom+=(int)mUI.getPreviewMenuLayout().getY();
  return rec.contains((int)ev.getX(),(int)ev.getY());
}

Fixed version (ground truth):
public boolean isOverPreviewMenu(MotionEvent ev){
  if (mPreviewMenuStatus != PREVIEW_MENU_ON)   return false;
  if (mUI.getPreviewMenuLayout() == null)   return false;
  Rect rec=new Rect();
  mUI.getPreviewMenuLayout().getChildAt(0).getHitRect(rec);
  if (View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())) {
    rec.left=mUI.getRootView().getWidth() - (rec.right - rec.left);
    rec.right=mUI.getRootView().getWidth();
  }
  rec.top+=(int)mUI.getPreviewMenuLayout().getY();
  rec.bottom+=(int)mUI.getPreviewMenuLayout().getY();
  return rec.contains((int)ev.getX(),(int)ev.getY());
}
Program: 38240
Project: 38240
Buggy source:
@Override public void onShutterButtonFocus(boolean pressed){
  if (mCameraDevice == null || mPaused || mUI.collapseCameraControls() || (mCameraState == SNAPSHOT_IN_PROGRESS) || (mCameraState == PREVIEW_STOPPED) || (null == mFocusManager)) {
    Log.v(TAG,"String_Node_Str" + mCameraState + "String_Node_Str"+ mCameraDevice+ "String_Node_Str"+ mPaused);
    return;
  }
synchronized (mCameraDevice) {
    if (mCameraState == LONGSHOT) {
      mLongshotActive=false;
      mCameraDevice.setLongshot(false);
      mUI.animateCapture(mLastJpegData,mLastJpegOrientation,mMirror);
      if (!mFocusManager.isZslEnabled()) {
        setupPreview();
      }
 else {
        setCameraState(IDLE);
        mFocusManager.resetTouchFocus();
        if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
          mCameraDevice.cancelAutoFocus();
        }
        mUI.resumeFaceDetection();
      }
    }
  }
  if (pressed && !canTakePicture())   return;
  if (pressed) {
    mFocusManager.onShutterDown();
  }
 else {
    if (!mUI.isCountingDown()) {
      mFocusManager.onShutterUp();
    }
  }
}

Fixed version (ground truth):
@Override public void onShutterButtonFocus(boolean pressed){
  if (mCameraDevice == null || mPaused || mUI.collapseCameraControls() || (mCameraState == SNAPSHOT_IN_PROGRESS) || (mCameraState == PREVIEW_STOPPED) || (null == mFocusManager)) {
    Log.v(TAG,"String_Node_Str" + mCameraState + "String_Node_Str"+ mCameraDevice+ "String_Node_Str"+ mPaused);
    return;
  }
synchronized (mCameraDevice) {
    if (mCameraState == LONGSHOT) {
      mLongshotActive=false;
      mCameraDevice.setLongshot(false);
      mUI.animateCapture(mLastJpegData,mLastJpegOrientation,mMirror);
      mLastJpegData=null;
      if (!mFocusManager.isZslEnabled()) {
        setupPreview();
      }
 else {
        setCameraState(IDLE);
        mFocusManager.resetTouchFocus();
        if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
          mCameraDevice.cancelAutoFocus();
        }
        mUI.resumeFaceDetection();
      }
    }
  }
  if (pressed && !canTakePicture())   return;
  if (pressed) {
    mFocusManager.onShutterDown();
  }
 else {
    if (!mUI.isCountingDown()) {
      mFocusManager.onShutterUp();
    }
  }
}
Program: 38241
Project: 38241
Buggy source:
private String getSDCardStorageState(){
  try {
    return mMountService.getVolumeState(mVolume.getPath());
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str" + e);
    return Environment.MEDIA_REMOVED;
  }
}

Fixed version (ground truth):
private String getSDCardStorageState(){
  return mVolume.getState();
}
Program: 38242
Project: 38242
Buggy source:
@Override public void onShutterButtonFocus(boolean pressed){
  if (mCameraDevice == null || mPaused || mUI.collapseCameraControls() || (mCameraState == SNAPSHOT_IN_PROGRESS) || (mCameraState == PREVIEW_STOPPED) || (null == mFocusManager)) {
    Log.v(TAG,"String_Node_Str" + mCameraState + "String_Node_Str"+ mCameraDevice+ "String_Node_Str"+ mPaused);
    return;
  }
synchronized (mCameraDevice) {
    if (mCameraState == LONGSHOT) {
      mLongshotActive=false;
      mCameraDevice.setLongshot(false);
      mUI.animateCapture(mLastJpegData,mLastJpegOrientation,mMirror);
      if (!mFocusManager.isZslEnabled()) {
        setupPreview();
      }
 else {
        setCameraState(IDLE);
        mFocusManager.resetTouchFocus();
        if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
          mCameraDevice.cancelAutoFocus();
        }
        mUI.resumeFaceDetection();
      }
    }
  }
  if (pressed && !canTakePicture())   return;
  if (pressed) {
    mFocusManager.onShutterDown();
  }
 else {
    if (!mUI.isCountingDown()) {
      mFocusManager.onShutterUp();
    }
  }
}

Fixed version (ground truth):
@Override public void onShutterButtonFocus(boolean pressed){
  if (mCameraDevice == null || mPaused || mUI.collapseCameraControls() || (mCameraState == SNAPSHOT_IN_PROGRESS) || (mCameraState == PREVIEW_STOPPED) || (null == mFocusManager)) {
    Log.v(TAG,"String_Node_Str" + mCameraState + "String_Node_Str"+ mCameraDevice+ "String_Node_Str"+ mPaused);
    return;
  }
synchronized (mCameraDevice) {
    if (mCameraState == LONGSHOT) {
      mLongshotActive=false;
      mCameraDevice.setLongshot(false);
      mUI.animateCapture(mLastJpegData,mLastJpegOrientation,mMirror);
      mLastJpegData=null;
      if (!mFocusManager.isZslEnabled()) {
        setupPreview();
      }
 else {
        setCameraState(IDLE);
        mFocusManager.resetTouchFocus();
        if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
          mCameraDevice.cancelAutoFocus();
        }
        mUI.resumeFaceDetection();
      }
    }
  }
  if (pressed && !canTakePicture())   return;
  if (pressed) {
    mFocusManager.onShutterDown();
  }
 else {
    if (!mUI.isCountingDown()) {
      mFocusManager.onShutterUp();
    }
  }
}
Program: 38244
Project: 38244
Buggy source:
public boolean isOverPreviewMenu(MotionEvent ev){
  if (mPreviewMenuStatus != PREVIEW_MENU_ON)   return false;
  if (mUI.getPreviewMenuLayout() == null)   return false;
  Rect rec=new Rect();
  mUI.getPreviewMenuLayout().getChildAt(0).getHitRect(rec);
  rec.top+=(int)mUI.getPreviewMenuLayout().getY();
  rec.bottom+=(int)mUI.getPreviewMenuLayout().getY();
  return rec.contains((int)ev.getX(),(int)ev.getY());
}

Fixed version (ground truth):
public boolean isOverPreviewMenu(MotionEvent ev){
  if (mPreviewMenuStatus != PREVIEW_MENU_ON)   return false;
  if (mUI.getPreviewMenuLayout() == null)   return false;
  Rect rec=new Rect();
  mUI.getPreviewMenuLayout().getChildAt(0).getHitRect(rec);
  if (View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())) {
    rec.left=mUI.getRootView().getWidth() - (rec.right - rec.left);
    rec.right=mUI.getRootView().getWidth();
  }
  rec.top+=(int)mUI.getPreviewMenuLayout().getY();
  rec.bottom+=(int)mUI.getPreviewMenuLayout().getY();
  return rec.contains((int)ev.getX(),(int)ev.getY());
}
Program: 38248
Project: 38248
Buggy source:
private void saveVideo(){
  if (mVideoFileDescriptor == null) {
    long duration=0L;
    if (mMediaRecorderPausing == false)     duration=SystemClock.uptimeMillis() - mRecordingStartTime + mRecordingTotalTime;
 else     duration=mRecordingTotalTime;
    if (duration > 0) {
      if (mCaptureTimeLapse) {
        duration=getTimeLapseVideoLength(duration);
      }
    }
 else {
      Log.w(TAG,"String_Node_Str" + duration);
    }
    File origFile=new File(mCurrentVideoFilename);
    if (!origFile.exists() || origFile.length() <= 0) {
      Log.e(TAG,"String_Node_Str");
      mCurrentVideoValues=null;
      return;
    }
    String hfr=mParameters.getVideoHighFrameRate();
    int defaultFps=30;
    int hfrRatio=1;
    if (!("String_Node_Str".equals(hfr))) {
      try {
        int hfrFps=Integer.parseInt(hfr);
        hfrRatio=hfrFps / defaultFps;
      }
 catch (      NumberFormatException ex) {
        Log.e(TAG,"String_Node_Str" + hfr);
      }
    }
    duration=duration * hfrRatio;
    mActivity.getMediaSaveService().addVideo(mCurrentVideoFilename,duration,mCurrentVideoValues,mOnVideoSavedListener,mContentResolver);
  }
  mCurrentVideoValues=null;
}

Fixed version (ground truth):
private void saveVideo(){
  if (mVideoFileDescriptor == null) {
    File origFile=new File(mCurrentVideoFilename);
    if (!origFile.exists() || origFile.length() <= 0) {
      Log.e(TAG,"String_Node_Str");
      mCurrentVideoValues=null;
      return;
    }
    long duration=0L;
    MediaMetadataRetriever retriever=new MediaMetadataRetriever();
    retriever.setDataSource(mCurrentVideoFilename);
    try {
      duration=Long.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
    }
 catch (    NumberFormatException e) {
      Log.e(TAG,"String_Node_Str");
    }
    retriever.release();
    mActivity.getMediaSaveService().addVideo(mCurrentVideoFilename,duration,mCurrentVideoValues,mOnVideoSavedListener,mContentResolver);
  }
  mCurrentVideoValues=null;
}
Program: 38250
Project: 38250
Buggy source:
private String getSDCardStorageState(){
  try {
    return mMountService.getVolumeState(mVolume.getPath());
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str" + e);
    return Environment.MEDIA_REMOVED;
  }
}

Fixed version (ground truth):
private String getSDCardStorageState(){
  return mVolume.getState();
}
Program: 38255
Project: 38255
Buggy source:
private void saveVideo(){
  if (mVideoFileDescriptor == null) {
    long duration=0L;
    if (mMediaRecorderPausing == false)     duration=SystemClock.uptimeMillis() - mRecordingStartTime + mRecordingTotalTime;
 else     duration=mRecordingTotalTime;
    if (duration > 0) {
      if (mCaptureTimeLapse) {
        duration=getTimeLapseVideoLength(duration);
      }
    }
 else {
      Log.w(TAG,"String_Node_Str" + duration);
    }
    File origFile=new File(mCurrentVideoFilename);
    if (!origFile.exists() || origFile.length() <= 0) {
      Log.e(TAG,"String_Node_Str");
      mCurrentVideoValues=null;
      return;
    }
    String hfr=mParameters.getVideoHighFrameRate();
    int defaultFps=30;
    int hfrRatio=1;
    if (!("String_Node_Str".equals(hfr))) {
      try {
        int hfrFps=Integer.parseInt(hfr);
        hfrRatio=hfrFps / defaultFps;
      }
 catch (      NumberFormatException ex) {
        Log.e(TAG,"String_Node_Str" + hfr);
      }
    }
    duration=duration * hfrRatio;
    mActivity.getMediaSaveService().addVideo(mCurrentVideoFilename,duration,mCurrentVideoValues,mOnVideoSavedListener,mContentResolver);
  }
  mCurrentVideoValues=null;
}

Fixed version (ground truth):
private void saveVideo(){
  if (mVideoFileDescriptor == null) {
    File origFile=new File(mCurrentVideoFilename);
    if (!origFile.exists() || origFile.length() <= 0) {
      Log.e(TAG,"String_Node_Str");
      mCurrentVideoValues=null;
      return;
    }
    long duration=0L;
    MediaMetadataRetriever retriever=new MediaMetadataRetriever();
    retriever.setDataSource(mCurrentVideoFilename);
    try {
      duration=Long.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
    }
 catch (    NumberFormatException e) {
      Log.e(TAG,"String_Node_Str");
    }
    retriever.release();
    mActivity.getMediaSaveService().addVideo(mCurrentVideoFilename,duration,mCurrentVideoValues,mOnVideoSavedListener,mContentResolver);
  }
  mCurrentVideoValues=null;
}
Program: 38256
Project: 38256
Buggy source:
@Override public void overrideSettings(final String... keyvalues){
  overrideCDSMode();
  super.overrideSettings(keyvalues);
  if (((mListMenu == null)) || mPopupStatus != POPUP_FIRST_LEVEL) {
    mPopupStatus=POPUP_FIRST_LEVEL;
    initializePopup();
  }
  mListMenu.overrideSettings(keyvalues);
}

Fixed version (ground truth):
@Override public void overrideSettings(final String... keyvalues){
  super.overrideSettings(keyvalues);
  if (mListMenu == null) {
    initializePopup();
  }
 else {
    overrideCDSMode();
  }
  mListMenu.overrideSettings(keyvalues);
}
Program: 38257
Project: 38257
Buggy source:
@Override public void overrideSettings(final String... keyvalues){
  overrideCDSMode();
  super.overrideSettings(keyvalues);
  if (((mListMenu == null)) || mPopupStatus != POPUP_FIRST_LEVEL) {
    mPopupStatus=POPUP_FIRST_LEVEL;
    initializePopup();
  }
  mListMenu.overrideSettings(keyvalues);
}

Fixed version (ground truth):
@Override public void overrideSettings(final String... keyvalues){
  super.overrideSettings(keyvalues);
  if (mListMenu == null) {
    initializePopup();
  }
 else {
    overrideCDSMode();
  }
  mListMenu.overrideSettings(keyvalues);
}
Program: 38258
Project: 38258
Buggy source:
/** 
 * This can run on a background thread, so don't do UI updates here. Post any view updates to MainHandler or do it on onPreviewStarted() .  
 */
private void startPreview(){
  if (mPaused || mCameraDevice == null || mParameters == null) {
    return;
  }
  SurfaceHolder sh=null;
  Log.v(TAG,"String_Node_Str");
  if (mUI != null) {
    sh=mUI.getSurfaceHolder();
  }
  setCameraParameters(UPDATE_PARAM_ALL);
  mCameraDevice.setPreviewDisplay(sh);
  if (!mCameraPreviewParamsReady) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  mCameraDevice.setErrorCallback(mErrorCallback);
  if (mCameraState != PREVIEW_STOPPED && mCameraState != INIT) {
    stopPreview();
  }
  setCameraParameters(UPDATE_PARAM_ALL);
  mCameraDevice.startPreview();
  mHandler.sendEmptyMessage(ON_PREVIEW_STARTED);
  setDisplayOrientation();
  if (!mSnapshotOnIdle) {
    if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
      mCameraDevice.cancelAutoFocus();
    }
    mFocusManager.setAeAwbLock(false);
  }
 else {
    mHandler.post(mDoSnapRunnable);
  }
}

Fixed version (ground truth):
/** 
 * This can run on a background thread, so don't do UI updates here. Post any view updates to MainHandler or do it on onPreviewStarted() .  
 */
private void startPreview(){
  if (mPaused || mCameraDevice == null || mParameters == null) {
    return;
  }
  SurfaceHolder sh=null;
  Log.v(TAG,"String_Node_Str");
  if (mUI != null) {
    sh=mUI.getSurfaceHolder();
  }
  setCameraParameters(UPDATE_PARAM_ALL);
  mCameraDevice.setPreviewDisplay(sh);
  if (!mCameraPreviewParamsReady) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  mCameraDevice.setErrorCallback(mErrorCallback);
  if (mCameraState != PREVIEW_STOPPED && mCameraState != INIT) {
    stopPreview();
  }
  if (!mSnapshotOnIdle) {
    mFocusManager.setAeAwbLock(false);
  }
  setCameraParameters(UPDATE_PARAM_ALL);
  mCameraDevice.startPreview();
  mHandler.sendEmptyMessage(ON_PREVIEW_STARTED);
  setDisplayOrientation();
  if (!mSnapshotOnIdle) {
    if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
      mCameraDevice.cancelAutoFocus();
    }
  }
 else {
    mHandler.post(mDoSnapRunnable);
  }
}
Program: 38259
Project: 38259
Buggy source:
/** 
 * This can run on a background thread, so don't do UI updates here. Post any view updates to MainHandler or do it on onPreviewStarted() .  
 */
private void startPreview(){
  if (mPaused || mCameraDevice == null || mParameters == null) {
    return;
  }
  SurfaceHolder sh=null;
  Log.v(TAG,"String_Node_Str");
  if (mUI != null) {
    sh=mUI.getSurfaceHolder();
  }
  setCameraParameters(UPDATE_PARAM_ALL);
  mCameraDevice.setPreviewDisplay(sh);
  if (!mCameraPreviewParamsReady) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  mCameraDevice.setErrorCallback(mErrorCallback);
  if (mCameraState != PREVIEW_STOPPED && mCameraState != INIT) {
    stopPreview();
  }
  setCameraParameters(UPDATE_PARAM_ALL);
  mCameraDevice.startPreview();
  mHandler.sendEmptyMessage(ON_PREVIEW_STARTED);
  setDisplayOrientation();
  if (!mSnapshotOnIdle) {
    if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
      mCameraDevice.cancelAutoFocus();
    }
    mFocusManager.setAeAwbLock(false);
  }
 else {
    mHandler.post(mDoSnapRunnable);
  }
}

Fixed version (ground truth):
/** 
 * This can run on a background thread, so don't do UI updates here. Post any view updates to MainHandler or do it on onPreviewStarted() .  
 */
private void startPreview(){
  if (mPaused || mCameraDevice == null || mParameters == null) {
    return;
  }
  SurfaceHolder sh=null;
  Log.v(TAG,"String_Node_Str");
  if (mUI != null) {
    sh=mUI.getSurfaceHolder();
  }
  setCameraParameters(UPDATE_PARAM_ALL);
  mCameraDevice.setPreviewDisplay(sh);
  if (!mCameraPreviewParamsReady) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  mCameraDevice.setErrorCallback(mErrorCallback);
  if (mCameraState != PREVIEW_STOPPED && mCameraState != INIT) {
    stopPreview();
  }
  if (!mSnapshotOnIdle) {
    mFocusManager.setAeAwbLock(false);
  }
  setCameraParameters(UPDATE_PARAM_ALL);
  mCameraDevice.startPreview();
  mHandler.sendEmptyMessage(ON_PREVIEW_STARTED);
  setDisplayOrientation();
  if (!mSnapshotOnIdle) {
    if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
      mCameraDevice.cancelAutoFocus();
    }
  }
 else {
    mHandler.post(mDoSnapRunnable);
  }
}
Program: 38260
Project: 38260
Buggy source:
@Override public void onProgress(boolean isFinished,float panningRateX,float panningRateY,float progressX,float progressY){
  float accumulatedHorizontalAngle=progressX * mHorizontalViewAngle;
  float accumulatedVerticalAngle=progressY * mVerticalViewAngle;
  boolean isRotated=!(mDeviceOrientationAtCapture == mDeviceOrientation);
  if (isFinished || (Math.abs(accumulatedHorizontalAngle) >= DEFAULT_SWEEP_ANGLE) || (Math.abs(accumulatedVerticalAngle) >= DEFAULT_SWEEP_ANGLE)|| isRotated) {
    stopCapture(false);
  }
 else {
    float panningRateXInDegree=panningRateX * mHorizontalViewAngle;
    float panningRateYInDegree=panningRateY * mVerticalViewAngle;
    mUI.updateCaptureProgress(panningRateXInDegree,panningRateYInDegree,accumulatedHorizontalAngle,accumulatedVerticalAngle,PANNING_SPEED_THRESHOLD);
  }
}

Fixed version (ground truth):
@Override public void onProgress(boolean isFinished,float panningRateX,float panningRateY,float progressX,float progressY){
  float accumulatedHorizontalAngle=progressX * mHorizontalViewAngle;
  float accumulatedVerticalAngle=progressY * mVerticalViewAngle;
  boolean isRotated=!(mDeviceOrientationAtCapture == mDeviceOrientation);
  if (isFinished || (Math.abs(accumulatedHorizontalAngle) >= DEFAULT_SWEEP_ANGLE) || (Math.abs(accumulatedVerticalAngle) >= DEFAULT_SWEEP_ANGLE)|| isRotated) {
    stopCapture(false);
  }
 else {
    float panningRateXInDegree=panningRateX * mHorizontalViewAngle;
    float panningRateYInDegree=panningRateY * mVerticalViewAngle;
    if (mDeviceOrientation == 180 || mDeviceOrientation == 90) {
      accumulatedHorizontalAngle=-accumulatedHorizontalAngle;
      accumulatedVerticalAngle=-accumulatedVerticalAngle;
    }
    mUI.updateCaptureProgress(panningRateXInDegree,panningRateYInDegree,accumulatedHorizontalAngle,accumulatedVerticalAngle,PANNING_SPEED_THRESHOLD);
  }
}
Program: 38262
Project: 38262
Buggy source:
@Override public void onProgress(boolean isFinished,float panningRateX,float panningRateY,float progressX,float progressY){
  float accumulatedHorizontalAngle=progressX * mHorizontalViewAngle;
  float accumulatedVerticalAngle=progressY * mVerticalViewAngle;
  boolean isRotated=!(mDeviceOrientationAtCapture == mDeviceOrientation);
  if (isFinished || (Math.abs(accumulatedHorizontalAngle) >= DEFAULT_SWEEP_ANGLE) || (Math.abs(accumulatedVerticalAngle) >= DEFAULT_SWEEP_ANGLE)|| isRotated) {
    stopCapture(false);
  }
 else {
    float panningRateXInDegree=panningRateX * mHorizontalViewAngle;
    float panningRateYInDegree=panningRateY * mVerticalViewAngle;
    mUI.updateCaptureProgress(panningRateXInDegree,panningRateYInDegree,accumulatedHorizontalAngle,accumulatedVerticalAngle,PANNING_SPEED_THRESHOLD);
  }
}

Fixed version (ground truth):
@Override public void onProgress(boolean isFinished,float panningRateX,float panningRateY,float progressX,float progressY){
  float accumulatedHorizontalAngle=progressX * mHorizontalViewAngle;
  float accumulatedVerticalAngle=progressY * mVerticalViewAngle;
  boolean isRotated=!(mDeviceOrientationAtCapture == mDeviceOrientation);
  if (isFinished || (Math.abs(accumulatedHorizontalAngle) >= DEFAULT_SWEEP_ANGLE) || (Math.abs(accumulatedVerticalAngle) >= DEFAULT_SWEEP_ANGLE)|| isRotated) {
    stopCapture(false);
  }
 else {
    float panningRateXInDegree=panningRateX * mHorizontalViewAngle;
    float panningRateYInDegree=panningRateY * mVerticalViewAngle;
    if (mDeviceOrientation == 180 || mDeviceOrientation == 90) {
      accumulatedHorizontalAngle=-accumulatedHorizontalAngle;
      accumulatedVerticalAngle=-accumulatedVerticalAngle;
    }
    mUI.updateCaptureProgress(panningRateXInDegree,panningRateYInDegree,accumulatedHorizontalAngle,accumulatedVerticalAngle,PANNING_SPEED_THRESHOLD);
  }
}
Program: 38266
Project: 38266
Buggy source:
private void switchCamera(){
  if (mPaused)   return;
  Log.v(TAG,"String_Node_Str" + mPendingSwitchCameraId);
  mCameraId=mPendingSwitchCameraId;
  mPendingSwitchCameraId=-1;
  setCameraId(mCameraId);
  closeCamera();
  mUI.collapseCameraControls();
  mUI.clearFaces();
  disableSkinToneSeekBar();
  if (mFocusManager != null)   mFocusManager.removeMessages();
  mPreferences.setLocalId(mActivity,mCameraId);
  CameraSettings.upgradeLocalPreferences(mPreferences.getLocal());
  mCameraDevice=CameraUtil.openCamera(mActivity,mCameraId,mHandler,mActivity.getCameraOpenErrorCallback());
  if (mCameraDevice == null) {
    Log.e(TAG,"String_Node_Str" + mCameraId + "String_Node_Str");
    return;
  }
  mParameters=mCameraDevice.getParameters();
  mInitialParams=mParameters;
  initializeCapabilities();
  CameraInfo info=CameraHolder.instance().getCameraInfo()[mCameraId];
  mMirror=(info.facing == CameraInfo.CAMERA_FACING_FRONT);
  mFocusManager.setMirror(mMirror);
  mFocusManager.setParameters(mInitialParams);
  setupPreview();
  mZoomValue=0;
  resizeForPreviewAspectRatio();
  openCameraCommon();
  mHandler.sendEmptyMessage(SWITCH_CAMERA_START_ANIMATION);
}

Fixed version (ground truth):
private void switchCamera(){
  if (mPaused)   return;
  Log.v(TAG,"String_Node_Str" + mPendingSwitchCameraId);
  mCameraId=mPendingSwitchCameraId;
  mPendingSwitchCameraId=-1;
  setCameraId(mCameraId);
  try {
    if (mOpenCameraThread != null) {
      mOpenCameraThread.join();
      mOpenCameraThread=null;
    }
  }
 catch (  InterruptedException ex) {
  }
  closeCamera();
  mUI.collapseCameraControls();
  mUI.clearFaces();
  disableSkinToneSeekBar();
  if (mFocusManager != null)   mFocusManager.removeMessages();
  mPreferences.setLocalId(mActivity,mCameraId);
  CameraSettings.upgradeLocalPreferences(mPreferences.getLocal());
  mCameraDevice=CameraUtil.openCamera(mActivity,mCameraId,mHandler,mActivity.getCameraOpenErrorCallback());
  if (mCameraDevice == null) {
    Log.e(TAG,"String_Node_Str" + mCameraId + "String_Node_Str");
    return;
  }
  mParameters=mCameraDevice.getParameters();
  mInitialParams=mParameters;
  initializeCapabilities();
  CameraInfo info=CameraHolder.instance().getCameraInfo()[mCameraId];
  mMirror=(info.facing == CameraInfo.CAMERA_FACING_FRONT);
  mFocusManager.setMirror(mMirror);
  mFocusManager.setParameters(mInitialParams);
  setupPreview();
  mZoomValue=0;
  resizeForPreviewAspectRatio();
  openCameraCommon();
  mHandler.sendEmptyMessage(SWITCH_CAMERA_START_ANIMATION);
}
Program: 38267
Project: 38267
Buggy source:
private void switchCamera(){
  if (mPaused)   return;
  Log.v(TAG,"String_Node_Str" + mPendingSwitchCameraId);
  mCameraId=mPendingSwitchCameraId;
  mPendingSwitchCameraId=-1;
  setCameraId(mCameraId);
  closeCamera();
  mUI.collapseCameraControls();
  mUI.clearFaces();
  disableSkinToneSeekBar();
  if (mFocusManager != null)   mFocusManager.removeMessages();
  mPreferences.setLocalId(mActivity,mCameraId);
  CameraSettings.upgradeLocalPreferences(mPreferences.getLocal());
  mCameraDevice=CameraUtil.openCamera(mActivity,mCameraId,mHandler,mActivity.getCameraOpenErrorCallback());
  if (mCameraDevice == null) {
    Log.e(TAG,"String_Node_Str" + mCameraId + "String_Node_Str");
    return;
  }
  mParameters=mCameraDevice.getParameters();
  mInitialParams=mParameters;
  initializeCapabilities();
  CameraInfo info=CameraHolder.instance().getCameraInfo()[mCameraId];
  mMirror=(info.facing == CameraInfo.CAMERA_FACING_FRONT);
  mFocusManager.setMirror(mMirror);
  mFocusManager.setParameters(mInitialParams);
  setupPreview();
  mZoomValue=0;
  resizeForPreviewAspectRatio();
  openCameraCommon();
  mHandler.sendEmptyMessage(SWITCH_CAMERA_START_ANIMATION);
}

Fixed version (ground truth):
private void switchCamera(){
  if (mPaused)   return;
  Log.v(TAG,"String_Node_Str" + mPendingSwitchCameraId);
  mCameraId=mPendingSwitchCameraId;
  mPendingSwitchCameraId=-1;
  setCameraId(mCameraId);
  try {
    if (mOpenCameraThread != null) {
      mOpenCameraThread.join();
      mOpenCameraThread=null;
    }
  }
 catch (  InterruptedException ex) {
  }
  closeCamera();
  mUI.collapseCameraControls();
  mUI.clearFaces();
  disableSkinToneSeekBar();
  if (mFocusManager != null)   mFocusManager.removeMessages();
  mPreferences.setLocalId(mActivity,mCameraId);
  CameraSettings.upgradeLocalPreferences(mPreferences.getLocal());
  mCameraDevice=CameraUtil.openCamera(mActivity,mCameraId,mHandler,mActivity.getCameraOpenErrorCallback());
  if (mCameraDevice == null) {
    Log.e(TAG,"String_Node_Str" + mCameraId + "String_Node_Str");
    return;
  }
  mParameters=mCameraDevice.getParameters();
  mInitialParams=mParameters;
  initializeCapabilities();
  CameraInfo info=CameraHolder.instance().getCameraInfo()[mCameraId];
  mMirror=(info.facing == CameraInfo.CAMERA_FACING_FRONT);
  mFocusManager.setMirror(mMirror);
  mFocusManager.setParameters(mInitialParams);
  setupPreview();
  mZoomValue=0;
  resizeForPreviewAspectRatio();
  openCameraCommon();
  mHandler.sendEmptyMessage(SWITCH_CAMERA_START_ANIMATION);
}
Program: 38269
Project: 38269
Buggy source:
private void saveVideo(){
  if (mVideoFileDescriptor == null) {
    long duration=SystemClock.uptimeMillis() - mRecordingStartTime + mRecordingTotalTime;
    if (duration > 0) {
      if (mCaptureTimeLapse) {
        duration=getTimeLapseVideoLength(duration);
      }
    }
 else {
      Log.w(TAG,"String_Node_Str" + duration);
    }
    File origFile=new File(mCurrentVideoFilename);
    if (!origFile.exists() || origFile.length() <= 0) {
      Log.e(TAG,"String_Node_Str");
      mCurrentVideoValues=null;
      return;
    }
    String hfr=mParameters.getVideoHighFrameRate();
    int defaultFps=30;
    int hfrRatio=1;
    if (!("String_Node_Str".equals(hfr))) {
      try {
        int hfrFps=Integer.parseInt(hfr);
        hfrRatio=hfrFps / defaultFps;
      }
 catch (      NumberFormatException ex) {
        Log.e(TAG,"String_Node_Str" + hfr);
      }
    }
    duration=duration * hfrRatio;
    mActivity.getMediaSaveService().addVideo(mCurrentVideoFilename,duration,mCurrentVideoValues,mOnVideoSavedListener,mContentResolver);
  }
  mCurrentVideoValues=null;
}

Fixed version (ground truth):
private void saveVideo(){
  if (mVideoFileDescriptor == null) {
    long duration=0L;
    if (mMediaRecorderPausing == false)     duration=SystemClock.uptimeMillis() - mRecordingStartTime + mRecordingTotalTime;
 else     duration=mRecordingTotalTime;
    if (duration > 0) {
      if (mCaptureTimeLapse) {
        duration=getTimeLapseVideoLength(duration);
      }
    }
 else {
      Log.w(TAG,"String_Node_Str" + duration);
    }
    File origFile=new File(mCurrentVideoFilename);
    if (!origFile.exists() || origFile.length() <= 0) {
      Log.e(TAG,"String_Node_Str");
      mCurrentVideoValues=null;
      return;
    }
    String hfr=mParameters.getVideoHighFrameRate();
    int defaultFps=30;
    int hfrRatio=1;
    if (!("String_Node_Str".equals(hfr))) {
      try {
        int hfrFps=Integer.parseInt(hfr);
        hfrRatio=hfrFps / defaultFps;
      }
 catch (      NumberFormatException ex) {
        Log.e(TAG,"String_Node_Str" + hfr);
      }
    }
    duration=duration * hfrRatio;
    mActivity.getMediaSaveService().addVideo(mCurrentVideoFilename,duration,mCurrentVideoValues,mOnVideoSavedListener,mContentResolver);
  }
  mCurrentVideoValues=null;
}
Program: 38271
Project: 38271
Buggy source:
private void saveVideo(){
  if (mVideoFileDescriptor == null) {
    long duration=SystemClock.uptimeMillis() - mRecordingStartTime + mRecordingTotalTime;
    if (duration > 0) {
      if (mCaptureTimeLapse) {
        duration=getTimeLapseVideoLength(duration);
      }
    }
 else {
      Log.w(TAG,"String_Node_Str" + duration);
    }
    File origFile=new File(mCurrentVideoFilename);
    if (!origFile.exists() || origFile.length() <= 0) {
      Log.e(TAG,"String_Node_Str");
      mCurrentVideoValues=null;
      return;
    }
    String hfr=mParameters.getVideoHighFrameRate();
    int defaultFps=30;
    int hfrRatio=1;
    if (!("String_Node_Str".equals(hfr))) {
      try {
        int hfrFps=Integer.parseInt(hfr);
        hfrRatio=hfrFps / defaultFps;
      }
 catch (      NumberFormatException ex) {
        Log.e(TAG,"String_Node_Str" + hfr);
      }
    }
    duration=duration * hfrRatio;
    mActivity.getMediaSaveService().addVideo(mCurrentVideoFilename,duration,mCurrentVideoValues,mOnVideoSavedListener,mContentResolver);
  }
  mCurrentVideoValues=null;
}

Fixed version (ground truth):
private void saveVideo(){
  if (mVideoFileDescriptor == null) {
    long duration=0L;
    if (mMediaRecorderPausing == false)     duration=SystemClock.uptimeMillis() - mRecordingStartTime + mRecordingTotalTime;
 else     duration=mRecordingTotalTime;
    if (duration > 0) {
      if (mCaptureTimeLapse) {
        duration=getTimeLapseVideoLength(duration);
      }
    }
 else {
      Log.w(TAG,"String_Node_Str" + duration);
    }
    File origFile=new File(mCurrentVideoFilename);
    if (!origFile.exists() || origFile.length() <= 0) {
      Log.e(TAG,"String_Node_Str");
      mCurrentVideoValues=null;
      return;
    }
    String hfr=mParameters.getVideoHighFrameRate();
    int defaultFps=30;
    int hfrRatio=1;
    if (!("String_Node_Str".equals(hfr))) {
      try {
        int hfrFps=Integer.parseInt(hfr);
        hfrRatio=hfrFps / defaultFps;
      }
 catch (      NumberFormatException ex) {
        Log.e(TAG,"String_Node_Str" + hfr);
      }
    }
    duration=duration * hfrRatio;
    mActivity.getMediaSaveService().addVideo(mCurrentVideoFilename,duration,mCurrentVideoValues,mOnVideoSavedListener,mContentResolver);
  }
  mCurrentVideoValues=null;
}
Program: 38276
Project: 38276
Buggy source:
@Override public void onResume(){
  if (Settings.System.getInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION,0) == 0) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    mAutoRotateScreen=false;
  }
 else {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
    mAutoRotateScreen=true;
  }
  UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,UsageStatistics.ACTION_FOREGROUNDED,this.getClass().getSimpleName());
  mOrientationListener.enable();
  mCurrentModule.onResumeBeforeSuper();
  super.onResume();
  mCurrentModule.onResumeAfterSuper();
  setSwipingEnabled(true);
  if (mResetToPreviewOnResume) {
    mFilmStripView.getController().goToFirstItem();
  }
  mResetToPreviewOnResume=true;
  if (mLocalVideosObserver.isMediaDataChangedDuringPause() || mLocalImagesObserver.isMediaDataChangedDuringPause()) {
    if (!mSecureCamera) {
      mDataAdapter.requestLoad(getContentResolver());
    }
  }
  mLocalImagesObserver.setActivityPaused(false);
  mLocalVideosObserver.setActivityPaused(false);
}

Fixed version (ground truth):
@Override public void onResume(){
  if (Settings.System.getInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION,0) == 0) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    mAutoRotateScreen=false;
  }
 else {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
    mAutoRotateScreen=true;
  }
  UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,UsageStatistics.ACTION_FOREGROUNDED,this.getClass().getSimpleName());
  mOrientationListener.enable();
  mCurrentModule.onResumeBeforeSuper();
  super.onResume();
  mCurrentModule.onResumeAfterSuper();
  setSwipingEnabled(true);
  if (mResetToPreviewOnResume) {
    mFilmStripView.getController().goToFirstItem();
  }
  mResetToPreviewOnResume=true;
  if (mLocalVideosObserver.isMediaDataChangedDuringPause() || mLocalImagesObserver.isMediaDataChangedDuringPause()) {
    if (!mSecureCamera) {
      mDataAdapter.requestLoad(getContentResolver());
    }
  }
  mLocalImagesObserver.setActivityPaused(false);
  mLocalVideosObserver.setActivityPaused(false);
  Log.d(TAG,"String_Node_Str");
  Intent intent=new Intent("String_Node_Str");
  intent.putExtra("String_Node_Str",true);
  sendBroadcast(intent);
}
Program: 38277
Project: 38277
Buggy source:
@Override public void onResume(){
  if (Settings.System.getInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION,0) == 0) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    mAutoRotateScreen=false;
  }
 else {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
    mAutoRotateScreen=true;
  }
  UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,UsageStatistics.ACTION_FOREGROUNDED,this.getClass().getSimpleName());
  mOrientationListener.enable();
  mCurrentModule.onResumeBeforeSuper();
  super.onResume();
  mCurrentModule.onResumeAfterSuper();
  setSwipingEnabled(true);
  if (mResetToPreviewOnResume) {
    mFilmStripView.getController().goToFirstItem();
  }
  mResetToPreviewOnResume=true;
  if (mLocalVideosObserver.isMediaDataChangedDuringPause() || mLocalImagesObserver.isMediaDataChangedDuringPause()) {
    if (!mSecureCamera) {
      mDataAdapter.requestLoad(getContentResolver());
    }
  }
  mLocalImagesObserver.setActivityPaused(false);
  mLocalVideosObserver.setActivityPaused(false);
}

Fixed version (ground truth):
@Override public void onResume(){
  if (Settings.System.getInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION,0) == 0) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    mAutoRotateScreen=false;
  }
 else {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
    mAutoRotateScreen=true;
  }
  UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,UsageStatistics.ACTION_FOREGROUNDED,this.getClass().getSimpleName());
  mOrientationListener.enable();
  mCurrentModule.onResumeBeforeSuper();
  super.onResume();
  mCurrentModule.onResumeAfterSuper();
  setSwipingEnabled(true);
  if (mResetToPreviewOnResume) {
    mFilmStripView.getController().goToFirstItem();
  }
  mResetToPreviewOnResume=true;
  if (mLocalVideosObserver.isMediaDataChangedDuringPause() || mLocalImagesObserver.isMediaDataChangedDuringPause()) {
    if (!mSecureCamera) {
      mDataAdapter.requestLoad(getContentResolver());
    }
  }
  mLocalImagesObserver.setActivityPaused(false);
  mLocalVideosObserver.setActivityPaused(false);
  Log.d(TAG,"String_Node_Str");
  Intent intent=new Intent("String_Node_Str");
  intent.putExtra("String_Node_Str",true);
  sendBroadcast(intent);
}
Program: 38280
Project: 38280
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ListPreference pref=mListItem.get(position);
  int viewLayoutId=getSettingLayoutId(pref);
  InLineSettingItem view=(InLineSettingItem)convertView;
  if (view == null) {
    view=(InLineSettingItem)mInflater.inflate(viewLayoutId,parent,false);
  }
  view.initialize(pref);
  view.setSettingChangedListener(MoreSettingPopup.this);
  if (position >= 0 && position < mEnabled.length) {
    view.setEnabled(mEnabled[position]);
  }
 else {
    Log.w(TAG,"String_Node_Str" + mEnabled.length + "String_Node_Str"+ position);
  }
  return view;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  ListPreference pref=mListItem.get(position);
  int viewLayoutId=getSettingLayoutId(pref);
  InLineSettingItem view=(InLineSettingItem)convertView;
  view=(InLineSettingItem)mInflater.inflate(viewLayoutId,parent,false);
  view.initialize(pref);
  view.setSettingChangedListener(MoreSettingPopup.this);
  if (position >= 0 && position < mEnabled.length) {
    view.setEnabled(mEnabled[position]);
  }
 else {
    Log.w(TAG,"String_Node_Str" + mEnabled.length + "String_Node_Str"+ position);
  }
  return view;
}
Program: 38281
Project: 38281
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ListPreference pref=mListItem.get(position);
  int viewLayoutId=getSettingLayoutId(pref);
  InLineSettingItem view=(InLineSettingItem)convertView;
  if (view == null) {
    view=(InLineSettingItem)mInflater.inflate(viewLayoutId,parent,false);
  }
  view.initialize(pref);
  view.setSettingChangedListener(MoreSettingPopup.this);
  if (position >= 0 && position < mEnabled.length) {
    view.setEnabled(mEnabled[position]);
  }
 else {
    Log.w(TAG,"String_Node_Str" + mEnabled.length + "String_Node_Str"+ position);
  }
  return view;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  ListPreference pref=mListItem.get(position);
  int viewLayoutId=getSettingLayoutId(pref);
  InLineSettingItem view=(InLineSettingItem)convertView;
  view=(InLineSettingItem)mInflater.inflate(viewLayoutId,parent,false);
  view.initialize(pref);
  view.setSettingChangedListener(MoreSettingPopup.this);
  if (position >= 0 && position < mEnabled.length) {
    view.setEnabled(mEnabled[position]);
  }
 else {
    Log.w(TAG,"String_Node_Str" + mEnabled.length + "String_Node_Str"+ position);
  }
  return view;
}
Program: 38282
Project: 38282
Buggy source:
@Override public void setParameters(Parameters params){
  if (params == null) {
    Log.v(TAG,"String_Node_Str");
    return;
  }
  mCameraHandler.obtainMessage(SET_PARAMETERS,params.flatten()).sendToTarget();
}

Fixed version (ground truth):
@Override public void setParameters(Parameters params){
  if (params == null) {
    Log.v(TAG,"String_Node_Str");
    return;
  }
  mSig.close();
  mCameraHandler.obtainMessage(SET_PARAMETERS,params).sendToTarget();
  mSig.block();
}
Program: 38284
Project: 38284
Buggy source:
@Override public void setParameters(Parameters params){
  if (params == null) {
    Log.v(TAG,"String_Node_Str");
    return;
  }
  mCameraHandler.obtainMessage(SET_PARAMETERS,params.flatten()).sendToTarget();
}

Fixed version (ground truth):
@Override public void setParameters(Parameters params){
  if (params == null) {
    Log.v(TAG,"String_Node_Str");
    return;
  }
  mSig.close();
  mCameraHandler.obtainMessage(SET_PARAMETERS,params).sendToTarget();
  mSig.block();
}
Program: 38286
Project: 38286
Buggy source:
/** 
 * Shows a progress indicator. If the progress is '100', the progress indicator will be hidden.
 * @param percent the progress in percent (0-100).
 */
public void setProgress(int percent){
  percent=Math.min(100,Math.max(percent,0));
  mProgressAngleDegrees=(int)((360f / 100) * percent);
  if (percent < 100) {
    mVisible=true;
  }
}

Fixed version (ground truth):
/** 
 * Shows a progress indicator. If the progress is '100', the progress indicator will be hidden.
 * @param percent the progress in percent (0-100).
 */
public void setProgress(int percent){
  percent=Math.min(100,Math.max(percent,0));
  mProgressAngleDegrees=(int)((360f / 100) * percent);
  if (percent < 100) {
    mVisible=true;
    mTimeToHide=System.currentTimeMillis() + SHOW_PROGRESS_X_ADDITIONAL_MS;
  }
}
Program: 38287
Project: 38287
Buggy source:
/** 
 * Draw the current progress (if < 100%) centered at the given location.
 */
public void onDraw(Canvas canvas,int centerX,int centerY){
  if (!mVisible) {
    return;
  }
  mArcBounds=new RectF(centerX - mProgressRadius,centerY - mProgressRadius,centerX + mProgressRadius,centerY + mProgressRadius);
  canvas.drawCircle(centerX,centerY,mProgressRadius,mProgressBasePaint);
  canvas.drawArc(mArcBounds,-90,mProgressAngleDegrees,false,mProgressPaint);
  if (mProgressAngleDegrees == 360) {
    if (showProgressXMoreFrames <= 0) {
      showProgressXMoreFrames=SHOW_PROGRESS_X_ADDITIONAL_FRAMES;
    }
 else {
      if (--showProgressXMoreFrames == 0) {
        mVisible=false;
        if (mVisibilityListener != null) {
          mVisibilityListener.onHidden();
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Draw the current progress (if < 100%) centered at the given location.
 */
public void onDraw(Canvas canvas,int centerX,int centerY){
  if (!mVisible) {
    return;
  }
  mArcBounds=new RectF(centerX - mProgressRadius,centerY - mProgressRadius,centerX + mProgressRadius,centerY + mProgressRadius);
  canvas.drawCircle(centerX,centerY,mProgressRadius,mProgressBasePaint);
  canvas.drawArc(mArcBounds,-90,mProgressAngleDegrees,false,mProgressPaint);
  if (mProgressAngleDegrees == 360 && System.currentTimeMillis() > mTimeToHide) {
    mVisible=false;
    if (mVisibilityListener != null) {
      mVisibilityListener.onHidden();
    }
  }
}
Program: 38288
Project: 38288
Buggy source:
/** 
 * Shows a progress indicator. If the progress is '100', the progress indicator will be hidden.
 * @param percent the progress in percent (0-100).
 */
public void setProgress(int percent){
  percent=Math.min(100,Math.max(percent,0));
  mProgressAngleDegrees=(int)((360f / 100) * percent);
  if (percent < 100) {
    mVisible=true;
  }
}

Fixed version (ground truth):
/** 
 * Shows a progress indicator. If the progress is '100', the progress indicator will be hidden.
 * @param percent the progress in percent (0-100).
 */
public void setProgress(int percent){
  percent=Math.min(100,Math.max(percent,0));
  mProgressAngleDegrees=(int)((360f / 100) * percent);
  if (percent < 100) {
    mVisible=true;
    mTimeToHide=System.currentTimeMillis() + SHOW_PROGRESS_X_ADDITIONAL_MS;
  }
}
Program: 38289
Project: 38289
Buggy source:
/** 
 * Draw the current progress (if < 100%) centered at the given location.
 */
public void onDraw(Canvas canvas,int centerX,int centerY){
  if (!mVisible) {
    return;
  }
  mArcBounds=new RectF(centerX - mProgressRadius,centerY - mProgressRadius,centerX + mProgressRadius,centerY + mProgressRadius);
  canvas.drawCircle(centerX,centerY,mProgressRadius,mProgressBasePaint);
  canvas.drawArc(mArcBounds,-90,mProgressAngleDegrees,false,mProgressPaint);
  if (mProgressAngleDegrees == 360) {
    if (showProgressXMoreFrames <= 0) {
      showProgressXMoreFrames=SHOW_PROGRESS_X_ADDITIONAL_FRAMES;
    }
 else {
      if (--showProgressXMoreFrames == 0) {
        mVisible=false;
        if (mVisibilityListener != null) {
          mVisibilityListener.onHidden();
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Draw the current progress (if < 100%) centered at the given location.
 */
public void onDraw(Canvas canvas,int centerX,int centerY){
  if (!mVisible) {
    return;
  }
  mArcBounds=new RectF(centerX - mProgressRadius,centerY - mProgressRadius,centerX + mProgressRadius,centerY + mProgressRadius);
  canvas.drawCircle(centerX,centerY,mProgressRadius,mProgressBasePaint);
  canvas.drawArc(mArcBounds,-90,mProgressAngleDegrees,false,mProgressPaint);
  if (mProgressAngleDegrees == 360 && System.currentTimeMillis() > mTimeToHide) {
    mVisible=false;
    if (mVisibilityListener != null) {
      mVisibilityListener.onHidden();
    }
  }
}
Program: 38290
Project: 38290
Buggy source:
/** 
 * Shows a progress indicator. If the progress is '100', the progress indicator will be hidden.
 * @param percent the progress in percent (0-100).
 */
public void setProgress(int percent){
  percent=Math.min(100,Math.max(percent,0));
  mProgressAngleDegrees=(int)((360f / 100) * percent);
  if (percent < 100) {
    mVisible=true;
  }
}

Fixed version (ground truth):
/** 
 * Shows a progress indicator. If the progress is '100', the progress indicator will be hidden.
 * @param percent the progress in percent (0-100).
 */
public void setProgress(int percent){
  percent=Math.min(100,Math.max(percent,0));
  mProgressAngleDegrees=(int)((360f / 100) * percent);
  if (percent < 100) {
    mVisible=true;
    mTimeToHide=System.currentTimeMillis() + SHOW_PROGRESS_X_ADDITIONAL_MS;
  }
}
Program: 38291
Project: 38291
Buggy source:
/** 
 * Draw the current progress (if < 100%) centered at the given location.
 */
public void onDraw(Canvas canvas,int centerX,int centerY){
  if (!mVisible) {
    return;
  }
  mArcBounds=new RectF(centerX - mProgressRadius,centerY - mProgressRadius,centerX + mProgressRadius,centerY + mProgressRadius);
  canvas.drawCircle(centerX,centerY,mProgressRadius,mProgressBasePaint);
  canvas.drawArc(mArcBounds,-90,mProgressAngleDegrees,false,mProgressPaint);
  if (mProgressAngleDegrees == 360) {
    if (showProgressXMoreFrames <= 0) {
      showProgressXMoreFrames=SHOW_PROGRESS_X_ADDITIONAL_FRAMES;
    }
 else {
      if (--showProgressXMoreFrames == 0) {
        mVisible=false;
        if (mVisibilityListener != null) {
          mVisibilityListener.onHidden();
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Draw the current progress (if < 100%) centered at the given location.
 */
public void onDraw(Canvas canvas,int centerX,int centerY){
  if (!mVisible) {
    return;
  }
  mArcBounds=new RectF(centerX - mProgressRadius,centerY - mProgressRadius,centerX + mProgressRadius,centerY + mProgressRadius);
  canvas.drawCircle(centerX,centerY,mProgressRadius,mProgressBasePaint);
  canvas.drawArc(mArcBounds,-90,mProgressAngleDegrees,false,mProgressPaint);
  if (mProgressAngleDegrees == 360 && System.currentTimeMillis() > mTimeToHide) {
    mVisible=false;
    if (mVisibilityListener != null) {
      mVisibilityListener.onHidden();
    }
  }
}
Program: 38292
Project: 38292
Buggy source:
@Override public void onListPrefChanged(ListPreference pref){
  if (mPopup1 != null && mPopup2 != null && mPopup3 != null) {
    if (mPopupStatus == POPUP_SECOND_LEVEL) {
      mUI.dismissPopup();
    }
  }
  onSettingChanged(pref);
}

Fixed version (ground truth):
@Override public void onListPrefChanged(ListPreference pref){
  if (mPopup != null && mPopup1 != null && mPopup2 != null && mPopup3 != null) {
    mUI.dismissPopup();
  }
  onSettingChanged(pref);
}
Program: 38293
Project: 38293
Buggy source:
@Override public void onListPrefChanged(ListPreference pref){
  if (mPopup1 != null && mPopup2 != null) {
    if (mPopupStatus == POPUP_SECOND_LEVEL) {
      mUI.dismissPopup(true);
    }
  }
  super.onSettingChanged(pref);
}

Fixed version (ground truth):
@Override public void onListPrefChanged(ListPreference pref){
  if (mPopup1 != null && mPopup2 != null) {
    if (mPopupStatus == POPUP_SECOND_LEVEL) {
      mUI.dismissPopup(true);
      mPopup1.reloadPreference();
      mPopup2.reloadPreference();
    }
  }
  super.onSettingChanged(pref);
}