Program: 38272
Project: 38272
Buggy source:
@Override public void onPictureTaken(final byte[] jpegData,CameraProxy camera){
  mUI.enableShutter(true);
  if (mPaused) {
    return;
  }
  if (mIsImageCaptureIntent) {
    stopPreview();
  }
  if (mSceneMode == CameraUtil.SCENE_MODE_HDR) {
    mUI.showSwitcher();
    mUI.setSwipingEnabled(true);
  }
  mReceivedSnapNum=mReceivedSnapNum + 1;
  mJpegPictureCallbackTime=System.currentTimeMillis();
  if (mSnapshotMode == CameraInfo.CAMERA_SUPPORT_MODE_ZSL) {
    Log.v(TAG,"String_Node_Str");
    mParameters=mCameraDevice.getParameters();
    mBurstSnapNum=mParameters.getInt("String_Node_Str");
  }
  Log.v(TAG,"String_Node_Str" + mReceivedSnapNum + "String_Node_Str"+ mBurstSnapNum);
  if (mPostViewPictureCallbackTime != 0) {
    mShutterToPictureDisplayedTime=mPostViewPictureCallbackTime - mShutterCallbackTime;
    mPictureDisplayedToJpegCallbackTime=mJpegPictureCallbackTime - mPostViewPictureCallbackTime;
  }
 else {
    mShutterToPictureDisplayedTime=mRawPictureCallbackTime - mShutterCallbackTime;
    mPictureDisplayedToJpegCallbackTime=mJpegPictureCallbackTime - mRawPictureCallbackTime;
  }
  Log.v(TAG,"String_Node_Str" + mPictureDisplayedToJpegCallbackTime + "String_Node_Str");
  mFocusManager.updateFocusUI();
  boolean needRestartPreview=!mIsImageCaptureIntent && !mPreviewRestartSupport && (mCameraState != LONGSHOT)&& (mSnapshotMode != CameraInfo.CAMERA_SUPPORT_MODE_ZSL)&& (mReceivedSnapNum == mBurstSnapNum);
  if (needRestartPreview) {
    setupPreview();
    if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
      mCameraDevice.cancelAutoFocus();
    }
  }
 else   if ((mReceivedSnapNum == mBurstSnapNum) && (mCameraState != LONGSHOT)) {
    mFocusManager.resetTouchFocus();
    if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
      mCameraDevice.cancelAutoFocus();
    }
    mUI.resumeFaceDetection();
    setCameraState(IDLE);
  }
  ExifInterface exif=Exif.getExif(jpegData);
  int orientation=Exif.getOrientation(exif);
  if (!mIsImageCaptureIntent) {
    if (mReceivedSnapNum > 1)     mNamedImages.nameNewImage(mCaptureStartTime);
    Size s=mParameters.getPictureSize();
    int width, height;
    if ((mJpegRotation + orientation) % 180 == 0) {
      width=s.width;
      height=s.height;
    }
 else {
      width=s.height;
      height=s.width;
    }
    String pictureFormat=mParameters.get(KEY_PICTURE_FORMAT);
    if (pictureFormat != null && !pictureFormat.equalsIgnoreCase(PIXEL_FORMAT_JPEG)) {
      String pair=mParameters.get(KEY_QC_RAW_PICUTRE_SIZE);
      if (pair != null) {
        int pos=pair.indexOf('x');
        if (pos != -1) {
          width=Integer.parseInt(pair.substring(0,pos));
          height=Integer.parseInt(pair.substring(pos + 1));
        }
      }
    }
    NamedEntity name=mNamedImages.getNextNameEntity();
    String title=(name == null) ? null : name.title;
    long date=(name == null) ? -1 : name.date;
    if (mDebugUri != null) {
      saveToDebugUri(jpegData);
      if (title != null) {
        title=DEBUG_IMAGE_PREFIX + title;
      }
    }
    if (title == null) {
      Log.e(TAG,"String_Node_Str");
    }
 else {
      if (date == -1)       date=mCaptureStartTime;
      if (mHeading >= 0) {
        ExifTag directionRefTag=exif.buildTag(ExifInterface.TAG_GPS_IMG_DIRECTION_REF,ExifInterface.GpsTrackRef.MAGNETIC_DIRECTION);
        ExifTag directionTag=exif.buildTag(ExifInterface.TAG_GPS_IMG_DIRECTION,new Rational(mHeading,1));
        exif.setTag(directionRefTag);
        exif.setTag(directionTag);
      }
      String mPictureFormat=mParameters.get(KEY_PICTURE_FORMAT);
      mActivity.getMediaSaveService().addImage(jpegData,title,date,mLocation,width,height,orientation,exif,mOnMediaSavedListener,mContentResolver,mPictureFormat);
    }
    if (mCameraState != LONGSHOT) {
      Size pic_size=mParameters.getPictureSize();
      if ((pic_size.width <= 352) && (pic_size.height <= 288)) {
        mUI.setDownFactor(2);
      }
 else {
        mUI.setDownFactor(4);
      }
      mUI.animateCapture(jpegData,orientation,mMirror);
    }
  }
 else {
    mJpegImageData=jpegData;
    if (!mQuickCapture) {
      mUI.showCapturedImageForReview(jpegData,orientation,mMirror);
    }
 else {
      onCaptureDone();
    }
  }
  mActivity.updateStorageSpaceAndHint();
  long now=System.currentTimeMillis();
  mJpegCallbackFinishTime=now - mJpegPictureCallbackTime;
  Log.v(TAG,"String_Node_Str" + mJpegCallbackFinishTime + "String_Node_Str");
  if (mReceivedSnapNum == mBurstSnapNum)   mJpegPictureCallbackTime=0;
  if (mHiston && (mSnapshotMode == CameraInfo.CAMERA_SUPPORT_MODE_ZSL)) {
    mActivity.runOnUiThread(new Runnable(){
      public void run(){
        if (mGraphView != null) {
          mGraphView.setVisibility(View.VISIBLE);
          mGraphView.PreviewChanged();
        }
      }
    }
);
  }
  if (mSnapshotMode == CameraInfo.CAMERA_SUPPORT_MODE_ZSL && mCameraState != LONGSHOT && mReceivedSnapNum == mBurstSnapNum) {
    cancelAutoFocus();
  }
}

Fixed version (ground truth):
@Override public void onPictureTaken(final byte[] jpegData,CameraProxy camera){
  mUI.enableShutter(true);
  if (mPaused) {
    return;
  }
  if (mIsImageCaptureIntent) {
    stopPreview();
  }
  if (mSceneMode == CameraUtil.SCENE_MODE_HDR) {
    mUI.showSwitcher();
    mUI.setSwipingEnabled(true);
  }
  mReceivedSnapNum=mReceivedSnapNum + 1;
  mJpegPictureCallbackTime=System.currentTimeMillis();
  if (mSnapshotMode == CameraInfo.CAMERA_SUPPORT_MODE_ZSL) {
    Log.v(TAG,"String_Node_Str");
    mParameters=mCameraDevice.getParameters();
    mBurstSnapNum=mParameters.getInt("String_Node_Str");
  }
  Log.v(TAG,"String_Node_Str" + mReceivedSnapNum + "String_Node_Str"+ mBurstSnapNum);
  if (mPostViewPictureCallbackTime != 0) {
    mShutterToPictureDisplayedTime=mPostViewPictureCallbackTime - mShutterCallbackTime;
    mPictureDisplayedToJpegCallbackTime=mJpegPictureCallbackTime - mPostViewPictureCallbackTime;
  }
 else {
    mShutterToPictureDisplayedTime=mRawPictureCallbackTime - mShutterCallbackTime;
    mPictureDisplayedToJpegCallbackTime=mJpegPictureCallbackTime - mRawPictureCallbackTime;
  }
  Log.v(TAG,"String_Node_Str" + mPictureDisplayedToJpegCallbackTime + "String_Node_Str");
  mFocusManager.updateFocusUI();
  boolean needRestartPreview=!mIsImageCaptureIntent && !mPreviewRestartSupport && (mCameraState != LONGSHOT)&& (mSnapshotMode != CameraInfo.CAMERA_SUPPORT_MODE_ZSL)&& (mReceivedSnapNum == mBurstSnapNum);
  if (needRestartPreview) {
    setupPreview();
    if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
      mCameraDevice.cancelAutoFocus();
    }
  }
 else   if ((mReceivedSnapNum == mBurstSnapNum) && (mCameraState != LONGSHOT)) {
    mFocusManager.resetTouchFocus();
    if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
      mCameraDevice.cancelAutoFocus();
    }
    mUI.resumeFaceDetection();
    if (!mIsImageCaptureIntent) {
      setCameraState(IDLE);
    }
  }
  ExifInterface exif=Exif.getExif(jpegData);
  int orientation=Exif.getOrientation(exif);
  if (!mIsImageCaptureIntent) {
    if (mReceivedSnapNum > 1)     mNamedImages.nameNewImage(mCaptureStartTime);
    Size s=mParameters.getPictureSize();
    int width, height;
    if ((mJpegRotation + orientation) % 180 == 0) {
      width=s.width;
      height=s.height;
    }
 else {
      width=s.height;
      height=s.width;
    }
    String pictureFormat=mParameters.get(KEY_PICTURE_FORMAT);
    if (pictureFormat != null && !pictureFormat.equalsIgnoreCase(PIXEL_FORMAT_JPEG)) {
      String pair=mParameters.get(KEY_QC_RAW_PICUTRE_SIZE);
      if (pair != null) {
        int pos=pair.indexOf('x');
        if (pos != -1) {
          width=Integer.parseInt(pair.substring(0,pos));
          height=Integer.parseInt(pair.substring(pos + 1));
        }
      }
    }
    NamedEntity name=mNamedImages.getNextNameEntity();
    String title=(name == null) ? null : name.title;
    long date=(name == null) ? -1 : name.date;
    if (mDebugUri != null) {
      saveToDebugUri(jpegData);
      if (title != null) {
        title=DEBUG_IMAGE_PREFIX + title;
      }
    }
    if (title == null) {
      Log.e(TAG,"String_Node_Str");
    }
 else {
      if (date == -1)       date=mCaptureStartTime;
      if (mHeading >= 0) {
        ExifTag directionRefTag=exif.buildTag(ExifInterface.TAG_GPS_IMG_DIRECTION_REF,ExifInterface.GpsTrackRef.MAGNETIC_DIRECTION);
        ExifTag directionTag=exif.buildTag(ExifInterface.TAG_GPS_IMG_DIRECTION,new Rational(mHeading,1));
        exif.setTag(directionRefTag);
        exif.setTag(directionTag);
      }
      String mPictureFormat=mParameters.get(KEY_PICTURE_FORMAT);
      mActivity.getMediaSaveService().addImage(jpegData,title,date,mLocation,width,height,orientation,exif,mOnMediaSavedListener,mContentResolver,mPictureFormat);
    }
    if (mCameraState != LONGSHOT) {
      Size pic_size=mParameters.getPictureSize();
      if ((pic_size.width <= 352) && (pic_size.height <= 288)) {
        mUI.setDownFactor(2);
      }
 else {
        mUI.setDownFactor(4);
      }
      mUI.animateCapture(jpegData,orientation,mMirror);
    }
  }
 else {
    mJpegImageData=jpegData;
    if (!mQuickCapture) {
      mUI.showCapturedImageForReview(jpegData,orientation,mMirror);
    }
 else {
      onCaptureDone();
    }
  }
  mActivity.updateStorageSpaceAndHint();
  long now=System.currentTimeMillis();
  mJpegCallbackFinishTime=now - mJpegPictureCallbackTime;
  Log.v(TAG,"String_Node_Str" + mJpegCallbackFinishTime + "String_Node_Str");
  if (mReceivedSnapNum == mBurstSnapNum)   mJpegPictureCallbackTime=0;
  if (mHiston && (mSnapshotMode == CameraInfo.CAMERA_SUPPORT_MODE_ZSL)) {
    mActivity.runOnUiThread(new Runnable(){
      public void run(){
        if (mGraphView != null) {
          mGraphView.setVisibility(View.VISIBLE);
          mGraphView.PreviewChanged();
        }
      }
    }
);
  }
  if (mSnapshotMode == CameraInfo.CAMERA_SUPPORT_MODE_ZSL && mCameraState != LONGSHOT && mReceivedSnapNum == mBurstSnapNum && !mIsImageCaptureIntent) {
    cancelAutoFocus();
  }
}