Program: 198729
Project: 198729
Buggy source:
/** 
 * Process the AF triggers from the request as a camera1 autofocus routine. <p>This method should be called after the parameters are   {@link LegacyRequestMapper mapped}with the request.</p> <p>Callbacks are processed in the background, and the next call to   {@link #mapResultTriggers}will have the latest AF state as reflected by the camera1 callbacks.</p> <p>None of the arguments will be mutated.</p>
 * @param captureRequest a non-{@code null} request
 * @param parameters a non-{@code null} parameters corresponding to this request (read-only)
 */
public void processRequestTriggers(CaptureRequest captureRequest,Camera.Parameters parameters){
  checkNotNull(captureRequest,"String_Node_Str");
  int afTrigger=ParamsUtils.getOrDefault(captureRequest,CONTROL_AF_TRIGGER,CONTROL_AF_TRIGGER_IDLE);
  final String afMode=parameters.getFocusMode();
  if (!Objects.equals(mAfModePrevious,afMode)) {
    if (VERBOSE) {
      Log.v(TAG,"String_Node_Str" + mAfModePrevious + "String_Node_Str"+ afMode);
    }
synchronized (mLock) {
      ++mAfRun;
      mAfState=CONTROL_AF_STATE_INACTIVE;
    }
  }
  mAfModePrevious=afMode;
{
    final int currentAfRun;
synchronized (mLock) {
      currentAfRun=mAfRun;
    }
    mCamera.setAutoFocusMoveCallback(new Camera.AutoFocusMoveCallback(){
      @Override public void onAutoFocusMoving(      boolean start,      Camera camera){
synchronized (mLock) {
          int latestAfRun=mAfRun;
          if (VERBOSE) {
            Log.v(TAG,"String_Node_Str" + start + "String_Node_Str"+ latestAfRun+ "String_Node_Str"+ currentAfRun);
          }
          if (currentAfRun != latestAfRun) {
            Log.d(TAG,"String_Node_Str" + currentAfRun);
            return;
          }
          int newAfState=start ? CONTROL_AF_STATE_PASSIVE_SCAN : CONTROL_AF_STATE_PASSIVE_FOCUSED;
switch (afMode) {
case Parameters.FOCUS_MODE_CONTINUOUS_PICTURE:
case Parameters.FOCUS_MODE_CONTINUOUS_VIDEO:
            break;
default :
          Log.w(TAG,"String_Node_Str" + afMode);
      }
      mAfState=newAfState;
    }
  }
}
);
}
switch (afTrigger) {
case CONTROL_AF_TRIGGER_START:
final int currentAfRun;
synchronized (mLock) {
currentAfRun=++mAfRun;
mAfState=CONTROL_AF_STATE_ACTIVE_SCAN;
}
if (VERBOSE) {
Log.v(TAG,"String_Node_Str" + "String_Node_Str" + currentAfRun);
}
mCamera.autoFocus(new Camera.AutoFocusCallback(){
@Override public void onAutoFocus(boolean success,Camera camera){
synchronized (mLock) {
int latestAfRun=mAfRun;
if (VERBOSE) {
  Log.v(TAG,"String_Node_Str" + success + "String_Node_Str"+ latestAfRun+ "String_Node_Str"+ currentAfRun);
}
if (latestAfRun != currentAfRun) {
  Log.d(TAG,String.format("String_Node_Str" + "String_Node_Str",currentAfRun,latestAfRun));
  return;
}
int newAfState=success ? CONTROL_AF_STATE_FOCUSED_LOCKED : CONTROL_AF_STATE_NOT_FOCUSED_LOCKED;
switch (afMode) {
case Parameters.FOCUS_MODE_AUTO:
case Parameters.FOCUS_MODE_CONTINUOUS_PICTURE:
case Parameters.FOCUS_MODE_CONTINUOUS_VIDEO:
case Parameters.FOCUS_MODE_MACRO:
  break;
default :
Log.w(TAG,"String_Node_Str" + afMode);
}
mAfState=newAfState;
}
}
}
);
break;
case CONTROL_AF_TRIGGER_CANCEL:
synchronized (mLock) {
int updatedAfRun=++mAfRun;
mCamera.cancelAutoFocus();
int newAfState=CONTROL_AF_STATE_INACTIVE;
mAfState=newAfState;
if (VERBOSE) {
Log.v(TAG,"String_Node_Str" + "String_Node_Str" + updatedAfRun);
}
}
break;
case CONTROL_AF_TRIGGER_IDLE:
break;
default :
Log.w(TAG,"String_Node_Str" + afTrigger);
}
}

Fixed version (ground truth):
/** 
 * Process the AF triggers from the request as a camera1 autofocus routine. <p>This method should be called after the parameters are   {@link LegacyRequestMapper mapped}with the request.</p> <p>Callbacks are processed in the background, and the next call to   {@link #mapResultTriggers}will have the latest AF state as reflected by the camera1 callbacks.</p> <p>None of the arguments will be mutated.</p>
 * @param captureRequest a non-{@code null} request
 * @param parameters a non-{@code null} parameters corresponding to this request (read-only)
 */
public void processRequestTriggers(CaptureRequest captureRequest,Camera.Parameters parameters){
  checkNotNull(captureRequest,"String_Node_Str");
  int afTrigger=ParamsUtils.getOrDefault(captureRequest,CONTROL_AF_TRIGGER,CONTROL_AF_TRIGGER_IDLE);
  final String afMode=parameters.getFocusMode();
  if (!Objects.equals(mAfModePrevious,afMode)) {
    if (VERBOSE) {
      Log.v(TAG,"String_Node_Str" + mAfModePrevious + "String_Node_Str"+ afMode);
    }
synchronized (mLock) {
      ++mAfRun;
      mAfState=CONTROL_AF_STATE_INACTIVE;
    }
    mCamera.cancelAutoFocus();
  }
  mAfModePrevious=afMode;
{
    final int currentAfRun;
synchronized (mLock) {
      currentAfRun=mAfRun;
    }
    mCamera.setAutoFocusMoveCallback(new Camera.AutoFocusMoveCallback(){
      @Override public void onAutoFocusMoving(      boolean start,      Camera camera){
synchronized (mLock) {
          int latestAfRun=mAfRun;
          if (VERBOSE) {
            Log.v(TAG,"String_Node_Str" + start + "String_Node_Str"+ latestAfRun+ "String_Node_Str"+ currentAfRun);
          }
          if (currentAfRun != latestAfRun) {
            Log.d(TAG,"String_Node_Str" + currentAfRun);
            return;
          }
          int newAfState=start ? CONTROL_AF_STATE_PASSIVE_SCAN : CONTROL_AF_STATE_PASSIVE_FOCUSED;
switch (afMode) {
case Parameters.FOCUS_MODE_CONTINUOUS_PICTURE:
case Parameters.FOCUS_MODE_CONTINUOUS_VIDEO:
            break;
default :
          Log.w(TAG,"String_Node_Str" + afMode);
      }
      mAfState=newAfState;
    }
  }
}
);
}
switch (afTrigger) {
case CONTROL_AF_TRIGGER_START:
int afStateAfterStart;
switch (afMode) {
case Parameters.FOCUS_MODE_AUTO:
case Parameters.FOCUS_MODE_MACRO:
afStateAfterStart=CONTROL_AF_STATE_ACTIVE_SCAN;
break;
case Parameters.FOCUS_MODE_CONTINUOUS_PICTURE:
case Parameters.FOCUS_MODE_CONTINUOUS_VIDEO:
afStateAfterStart=CONTROL_AF_STATE_PASSIVE_SCAN;
default :
afStateAfterStart=CONTROL_AF_STATE_INACTIVE;
}
final int currentAfRun;
synchronized (mLock) {
currentAfRun=++mAfRun;
mAfState=afStateAfterStart;
}
if (VERBOSE) {
Log.v(TAG,"String_Node_Str" + "String_Node_Str" + currentAfRun);
}
mCamera.autoFocus(new Camera.AutoFocusCallback(){
@Override public void onAutoFocus(boolean success,Camera camera){
synchronized (mLock) {
int latestAfRun=mAfRun;
if (VERBOSE) {
Log.v(TAG,"String_Node_Str" + success + "String_Node_Str"+ latestAfRun+ "String_Node_Str"+ currentAfRun);
}
if (latestAfRun != currentAfRun) {
Log.d(TAG,String.format("String_Node_Str" + "String_Node_Str",currentAfRun,latestAfRun));
return;
}
int newAfState=success ? CONTROL_AF_STATE_FOCUSED_LOCKED : CONTROL_AF_STATE_NOT_FOCUSED_LOCKED;
switch (afMode) {
case Parameters.FOCUS_MODE_AUTO:
case Parameters.FOCUS_MODE_CONTINUOUS_PICTURE:
case Parameters.FOCUS_MODE_CONTINUOUS_VIDEO:
case Parameters.FOCUS_MODE_MACRO:
break;
default :
Log.w(TAG,"String_Node_Str" + afMode);
}
mAfState=newAfState;
}
}
}
);
break;
case CONTROL_AF_TRIGGER_CANCEL:
synchronized (mLock) {
int updatedAfRun;
synchronized (mLock) {
updatedAfRun=++mAfRun;
mAfState=CONTROL_AF_STATE_INACTIVE;
}
mCamera.cancelAutoFocus();
if (VERBOSE) {
Log.v(TAG,"String_Node_Str" + "String_Node_Str" + updatedAfRun);
}
}
break;
case CONTROL_AF_TRIGGER_IDLE:
break;
default :
Log.w(TAG,"String_Node_Str" + afTrigger);
}
}