Program: 199368
Project: 199368
Buggy source:
/** 
 * This method checks lastFrameNumber returned from ICameraDeviceUser methods for starting and stopping repeating request and flushing. <p>If lastFrameNumber is NO_FRAMES_CAPTURED, it means that the request was never sent to HAL. Then onCaptureSequenceCompleted is immediately triggered. If lastFrameNumber is non-negative, then the requestId and lastFrameNumber pair is added to the list mFrameNumberRequestPairs.</p>
 * @param requestId the request ID of the current repeating request.
 * @param lastFrameNumber last frame number returned from binder.
 */
private void checkEarlyTriggerSequenceComplete(final int requestId,final long lastFrameNumber){
  if (lastFrameNumber == CaptureListener.NO_FRAMES_CAPTURED) {
    final CaptureListenerHolder holder;
    int index=mCaptureListenerMap.indexOfKey(requestId);
    holder=(index >= 0) ? mCaptureListenerMap.valueAt(index) : null;
    if (holder != null) {
      mCaptureListenerMap.removeAt(index);
    }
    if (holder != null) {
      if (DEBUG) {
        Log.v(TAG,"String_Node_Str" + "String_Node_Str");
      }
      Runnable resultDispatch=new Runnable(){
        @Override public void run(){
          if (!CameraDevice.this.isClosed()) {
            if (DEBUG) {
              Log.d(TAG,String.format("String_Node_Str",requestId));
            }
            if (lastFrameNumber < Integer.MIN_VALUE || lastFrameNumber > Integer.MAX_VALUE) {
              throw new AssertionError(lastFrameNumber + "String_Node_Str");
            }
            holder.getListener().onCaptureSequenceCompleted(CameraDevice.this,requestId,(int)lastFrameNumber);
          }
        }
      }
;
      holder.getHandler().post(resultDispatch);
    }
 else {
      Log.w(TAG,String.format("String_Node_Str",requestId));
    }
  }
 else {
    mFrameNumberRequestPairs.add(new SimpleEntry<Long,Integer>(lastFrameNumber,requestId));
  }
}

Fixed version (ground truth):
/** 
 * This method checks lastFrameNumber returned from ICameraDeviceUser methods for starting and stopping repeating request and flushing. <p>If lastFrameNumber is NO_FRAMES_CAPTURED, it means that the request was never sent to HAL. Then onCaptureSequenceCompleted is immediately triggered. If lastFrameNumber is non-negative, then the requestId and lastFrameNumber pair is added to the list mFrameNumberRequestPairs.</p>
 * @param requestId the request ID of the current repeating request.
 * @param lastFrameNumber last frame number returned from binder.
 */
private void checkEarlyTriggerSequenceComplete(final int requestId,final long lastFrameNumber){
  if (lastFrameNumber == CaptureListener.NO_FRAMES_CAPTURED) {
    final CaptureListenerHolder holder;
    int index=mCaptureListenerMap.indexOfKey(requestId);
    holder=(index >= 0) ? mCaptureListenerMap.valueAt(index) : null;
    if (holder != null) {
      mCaptureListenerMap.removeAt(index);
      if (DEBUG) {
        Log.v(TAG,String.format("String_Node_Str" + "String_Node_Str",requestId,lastFrameNumber));
      }
    }
    if (holder != null) {
      if (DEBUG) {
        Log.v(TAG,"String_Node_Str" + "String_Node_Str");
      }
      Runnable resultDispatch=new Runnable(){
        @Override public void run(){
          if (!CameraDevice.this.isClosed()) {
            if (DEBUG) {
              Log.d(TAG,String.format("String_Node_Str",requestId));
            }
            if (lastFrameNumber < Integer.MIN_VALUE || lastFrameNumber > Integer.MAX_VALUE) {
              throw new AssertionError(lastFrameNumber + "String_Node_Str");
            }
            holder.getListener().onCaptureSequenceCompleted(CameraDevice.this,requestId,(int)lastFrameNumber);
          }
        }
      }
;
      holder.getHandler().post(resultDispatch);
    }
 else {
      Log.w(TAG,String.format("String_Node_Str",requestId));
    }
  }
 else {
    mFrameNumberRequestPairs.add(new SimpleEntry<Long,Integer>(lastFrameNumber,requestId));
  }
}