Program: 193744
Project: 193744
Buggy source:
private int stopOrientationMeasurementLocked(){
  if (DEBUG)   Slog.d(TAG,"String_Node_Str" + mMeasurementInProgress);
  int status=RESULT_UNKNOWN;
  if (mMeasurementInProgress) {
    mSensorManager.unregisterListener(mListener);
    mHandler.removeCallbacks(mMeasurementTimeout);
    if (mWakeLock.isHeld()) {
      mWakeLock.release();
    }
    long detectionEndTime=SystemClock.elapsedRealtime();
    mMeasurementInProgress=false;
    mPreviousGravityVector=mCurrentGravityVector;
    mCurrentGravityVector=mRunningStats.getRunningAverage();
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + mRunningStats.toString());
      String currentGravityVectorString=(mCurrentGravityVector == null) ? "String_Node_Str" : mCurrentGravityVector.toString();
      String previousGravityVectorString=(mPreviousGravityVector == null) ? "String_Node_Str" : mPreviousGravityVector.toString();
      Slog.d(TAG,"String_Node_Str" + currentGravityVectorString);
      Slog.d(TAG,"String_Node_Str" + previousGravityVectorString);
    }
    mRunningStats.reset();
    status=getStationaryStatus();
    if (DEBUG)     Slog.d(TAG,"String_Node_Str" + status);
    if (status != RESULT_UNKNOWN) {
      if (DEBUG)       Slog.d(TAG,"String_Node_Str" + status);
      mState=STATE_INACTIVE;
    }
 else {
      if (DEBUG)       Slog.d(TAG,"String_Node_Str" + "String_Node_Str" + ORIENTATION_MEASUREMENT_INTERVAL_MILLIS + "String_Node_Str");
      Message msg=Message.obtain(mHandler,mSensorRestart);
      msg.setAsynchronous(true);
      mHandler.sendMessageDelayed(msg,ORIENTATION_MEASUREMENT_INTERVAL_MILLIS);
    }
  }
  return status;
}

Fixed version (ground truth):
private int stopOrientationMeasurementLocked(){
  if (DEBUG)   Slog.d(TAG,"String_Node_Str" + mMeasurementInProgress);
  int status=RESULT_UNKNOWN;
  if (mMeasurementInProgress) {
    mSensorManager.unregisterListener(mListener);
    mHandler.removeCallbacks(mMeasurementTimeout);
    mWakeLock.release();
    long detectionEndTime=SystemClock.elapsedRealtime();
    mMeasurementInProgress=false;
    mPreviousGravityVector=mCurrentGravityVector;
    mCurrentGravityVector=mRunningStats.getRunningAverage();
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + mRunningStats.toString());
      String currentGravityVectorString=(mCurrentGravityVector == null) ? "String_Node_Str" : mCurrentGravityVector.toString();
      String previousGravityVectorString=(mPreviousGravityVector == null) ? "String_Node_Str" : mPreviousGravityVector.toString();
      Slog.d(TAG,"String_Node_Str" + currentGravityVectorString);
      Slog.d(TAG,"String_Node_Str" + previousGravityVectorString);
    }
    mRunningStats.reset();
    status=getStationaryStatus();
    if (DEBUG)     Slog.d(TAG,"String_Node_Str" + status);
    if (status != RESULT_UNKNOWN) {
      if (DEBUG)       Slog.d(TAG,"String_Node_Str" + status);
      mState=STATE_INACTIVE;
    }
 else {
      if (DEBUG)       Slog.d(TAG,"String_Node_Str" + "String_Node_Str" + ORIENTATION_MEASUREMENT_INTERVAL_MILLIS + "String_Node_Str");
      Message msg=Message.obtain(mHandler,mSensorRestart);
      msg.setAsynchronous(true);
      mHandler.sendMessageDelayed(msg,ORIENTATION_MEASUREMENT_INTERVAL_MILLIS);
    }
  }
  return status;
}