Program: 38252
Project: 38252
Buggy source:
@Override protected void onDraw(Canvas canvas){
  if (!mBlocked && (mFaces != null) && (mFaces.length > 0)) {
    int rw, rh;
    rw=mUncroppedWidth;
    rh=mUncroppedHeight;
    if (((rh > rw) && ((mDisplayOrientation == 0) || (mDisplayOrientation == 180))) || ((rw > rh) && ((mDisplayOrientation == 90) || (mDisplayOrientation == 270)))) {
      int temp=rw;
      rw=rh;
      rh=temp;
    }
    CameraUtil.prepareMatrix(mMatrix,mMirror,mDisplayOrientation,rw,rh);
    int dx=(getWidth() - rw) / 2;
    ;
    int dy=(getHeight() - rh) / 2;
    canvas.save();
    mMatrix.postRotate(mOrientation);
    canvas.rotate(-mOrientation);
    for (int i=0; i < mFaces.length; i++) {
      if (mFaces[i].score < 50)       continue;
      mRect.set(mFaces[i].rect);
      if (LOGV)       CameraUtil.dumpRect(mRect,"String_Node_Str");
      mMatrix.mapRect(mRect);
      if (LOGV)       CameraUtil.dumpRect(mRect,"String_Node_Str");
      mPaint.setColor(mColor);
      mRect.offset(dx,dy);
      canvas.drawOval(mRect,mPaint);
      if (mFaces[i] instanceof ExtendedFace) {
        ExtendedFace face=(ExtendedFace)mFaces[i];
        float[] point=new float[4];
        int delta_x=mFaces[i].rect.width() / 12;
        int delta_y=mFaces[i].rect.height() / 12;
        Log.e(TAG,"String_Node_Str" + face.getLeftEyeBlinkDegree() + "String_Node_Str"+ face.getRightEyeBlinkDegree()+ "String_Node_Str");
        if (face.leftEye != null) {
          if ((mDisplayRotation == 0) || (mDisplayRotation == 180)) {
            point[0]=face.leftEye.x;
            point[1]=face.leftEye.y - delta_y / 2;
            point[2]=face.leftEye.x;
            point[3]=face.leftEye.y + delta_y / 2;
          }
 else {
            point[0]=face.leftEye.x - delta_x / 2;
            point[1]=face.leftEye.y;
            point[2]=face.leftEye.x + delta_x / 2;
            point[3]=face.leftEye.y;
          }
          mMatrix.mapPoints(point);
          if (face.getLeftEyeBlinkDegree() >= blink_threshold) {
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
        }
        if (face.rightEye != null) {
          if ((mDisplayRotation == 0) || (mDisplayRotation == 180)) {
            point[0]=face.rightEye.x;
            point[1]=face.rightEye.y - delta_y / 2;
            point[2]=face.rightEye.x;
            point[3]=face.rightEye.y + delta_y / 2;
          }
 else {
            point[0]=face.rightEye.x - delta_x / 2;
            point[1]=face.rightEye.y;
            point[2]=face.rightEye.x + delta_x / 2;
            point[3]=face.rightEye.y;
          }
          mMatrix.mapPoints(point);
          if (face.getRightEyeBlinkDegree() >= blink_threshold) {
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
        }
        if (face.getLeftRightGazeDegree() != 0 || face.getTopBottomGazeDegree() != 0) {
          double length=Math.sqrt((face.leftEye.x - face.rightEye.x) * (face.leftEye.x - face.rightEye.x) + (face.leftEye.y - face.rightEye.y) * (face.leftEye.y - face.rightEye.y)) / 2.0;
          double nGazeYaw=-face.getLeftRightGazeDegree();
          double nGazePitch=-face.getTopBottomGazeDegree();
          float gazeRollX=(float)((-Math.sin(nGazeYaw / 180.0 * Math.PI) * Math.cos(-face.getRollDirection() / 180.0 * Math.PI) + Math.sin(nGazePitch / 180.0 * Math.PI) * Math.cos(nGazeYaw / 180.0 * Math.PI) * Math.sin(-face.getRollDirection() / 180.0 * Math.PI)) * (-length) + 0.5);
          float gazeRollY=(float)((Math.sin(-nGazeYaw / 180.0 * Math.PI) * Math.sin(-face.getRollDirection() / 180.0 * Math.PI) - Math.sin(nGazePitch / 180.0 * Math.PI) * Math.cos(nGazeYaw / 180.0 * Math.PI) * Math.cos(-face.getRollDirection() / 180.0 * Math.PI)) * (-length) + 0.5);
          if (face.getLeftEyeBlinkDegree() < blink_threshold) {
            if ((mDisplayRotation == 90) || (mDisplayRotation == 270)) {
              point[0]=face.leftEye.x;
              point[1]=face.leftEye.y;
              point[2]=face.leftEye.x + gazeRollX;
              point[3]=face.leftEye.y + gazeRollY;
            }
 else {
              point[0]=face.leftEye.x;
              point[1]=face.leftEye.y;
              point[2]=face.leftEye.x + gazeRollY;
              point[3]=face.leftEye.y + gazeRollX;
            }
            mMatrix.mapPoints(point);
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
          if (face.getRightEyeBlinkDegree() < blink_threshold) {
            if ((mDisplayRotation == 90) || (mDisplayRotation == 270)) {
              point[0]=face.rightEye.x;
              point[1]=face.rightEye.y;
              point[2]=face.rightEye.x + gazeRollX;
              point[3]=face.rightEye.y + gazeRollY;
            }
 else {
              point[0]=face.rightEye.x;
              point[1]=face.rightEye.y;
              point[2]=face.rightEye.x + gazeRollY;
              point[3]=face.rightEye.y + gazeRollX;
            }
            mMatrix.mapPoints(point);
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
        }
        if (face.mouth != null) {
          Log.e(TAG,"String_Node_Str" + face.getSmileDegree() + "String_Node_Str"+ face.getSmileScore());
          if (face.getSmileDegree() < smile_threashold_no_smile) {
            if ((mDisplayRotation == 90) || (mDisplayRotation == 270)) {
              point[0]=face.mouth.x + dx - delta_x;
              point[1]=face.mouth.y;
              point[2]=face.mouth.x + dx + delta_x;
              point[3]=face.mouth.y;
            }
 else {
              point[0]=face.mouth.x;
              point[1]=face.mouth.y + dy - delta_y;
              point[2]=face.mouth.x;
              point[3]=face.mouth.y + dy + delta_y;
            }
            Matrix faceMatrix=new Matrix(mMatrix);
            faceMatrix.preRotate(face.getRollDirection(),face.mouth.x,face.mouth.y);
            faceMatrix.mapPoints(point);
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
 else           if (face.getSmileDegree() < smile_threashold_small_smile) {
            int rotation_mouth=360 - mDisplayRotation;
            mRect.set(face.mouth.x - delta_x,face.mouth.y - delta_y,face.mouth.x + delta_x,face.mouth.y + delta_y);
            mMatrix.mapRect(mRect);
            mRect.offset(dx,dy);
            canvas.drawArc(mRect,rotation_mouth,180,true,mPaint);
          }
 else {
            mRect.set(face.mouth.x - delta_x,face.mouth.y - delta_y,face.mouth.x + delta_x,face.mouth.y + delta_y);
            mMatrix.mapRect(mRect);
            mRect.offset(dx,dy);
            canvas.drawOval(mRect,mPaint);
          }
        }
      }
    }
    canvas.restore();
  }
  super.onDraw(canvas);
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  if (!mBlocked && (mFaces != null) && (mFaces.length > 0)) {
    int rw, rh;
    rw=mUncroppedWidth;
    rh=mUncroppedHeight;
    if (((rh > rw) && ((mDisplayOrientation == 0) || (mDisplayOrientation == 180))) || ((rw > rh) && ((mDisplayOrientation == 90) || (mDisplayOrientation == 270)))) {
      int temp=rw;
      rw=rh;
      rh=temp;
    }
    CameraUtil.prepareMatrix(mMatrix,mMirror,mDisplayOrientation,rw,rh);
    int dx=(getWidth() - rw) / 2;
    ;
    int dy=(getHeight() - rh) / 2;
    canvas.save();
    mMatrix.postRotate(mOrientation);
    canvas.rotate(-mOrientation);
    for (int i=0; i < mFaces.length; i++) {
      if (mFaces[i].score < 50)       continue;
      mRect.set(mFaces[i].rect);
      if (LOGV)       CameraUtil.dumpRect(mRect,"String_Node_Str");
      mMatrix.mapRect(mRect);
      if (LOGV)       CameraUtil.dumpRect(mRect,"String_Node_Str");
      mPaint.setColor(mColor);
      mRect.offset(dx,dy);
      canvas.drawOval(mRect,mPaint);
      if (mFaces[i] instanceof ExtendedFace) {
        ExtendedFace face=(ExtendedFace)mFaces[i];
        float[] point=new float[4];
        int delta_x=mFaces[i].rect.width() / 12;
        int delta_y=mFaces[i].rect.height() / 12;
        Log.e(TAG,"String_Node_Str" + face.getLeftEyeBlinkDegree() + "String_Node_Str"+ face.getRightEyeBlinkDegree()+ "String_Node_Str");
        if (face.leftEye != null) {
          if ((mDisplayRotation == 0) || (mDisplayRotation == 180)) {
            point[0]=face.leftEye.x;
            point[1]=face.leftEye.y - delta_y / 2;
            point[2]=face.leftEye.x;
            point[3]=face.leftEye.y + delta_y / 2;
          }
 else {
            point[0]=face.leftEye.x - delta_x / 2;
            point[1]=face.leftEye.y;
            point[2]=face.leftEye.x + delta_x / 2;
            point[3]=face.leftEye.y;
          }
          mMatrix.mapPoints(point);
          if (face.getLeftEyeBlinkDegree() >= blink_threshold) {
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
        }
        if (face.rightEye != null) {
          if ((mDisplayRotation == 0) || (mDisplayRotation == 180)) {
            point[0]=face.rightEye.x;
            point[1]=face.rightEye.y - delta_y / 2;
            point[2]=face.rightEye.x;
            point[3]=face.rightEye.y + delta_y / 2;
          }
 else {
            point[0]=face.rightEye.x - delta_x / 2;
            point[1]=face.rightEye.y;
            point[2]=face.rightEye.x + delta_x / 2;
            point[3]=face.rightEye.y;
          }
          mMatrix.mapPoints(point);
          if (face.getRightEyeBlinkDegree() >= blink_threshold) {
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
        }
        if (face.getLeftRightGazeDegree() != 0 || face.getTopBottomGazeDegree() != 0) {
          double length=Math.sqrt((face.leftEye.x - face.rightEye.x) * (face.leftEye.x - face.rightEye.x) + (face.leftEye.y - face.rightEye.y) * (face.leftEye.y - face.rightEye.y)) / 2.0;
          double nGazeYaw=-face.getLeftRightGazeDegree();
          double nGazePitch=-face.getTopBottomGazeDegree();
          float gazeRollX=(float)((-Math.sin(nGazeYaw / 180.0 * Math.PI) * Math.cos(-face.getRollDirection() / 180.0 * Math.PI) + Math.sin(nGazePitch / 180.0 * Math.PI) * Math.cos(nGazeYaw / 180.0 * Math.PI) * Math.sin(-face.getRollDirection() / 180.0 * Math.PI)) * (-length) + 0.5);
          float gazeRollY=(float)((Math.sin(-nGazeYaw / 180.0 * Math.PI) * Math.sin(-face.getRollDirection() / 180.0 * Math.PI) - Math.sin(nGazePitch / 180.0 * Math.PI) * Math.cos(nGazeYaw / 180.0 * Math.PI) * Math.cos(-face.getRollDirection() / 180.0 * Math.PI)) * (-length) + 0.5);
          if (face.getLeftEyeBlinkDegree() < blink_threshold) {
            if ((mDisplayRotation == 90) || (mDisplayRotation == 270)) {
              point[0]=face.leftEye.x;
              point[1]=face.leftEye.y;
              point[2]=face.leftEye.x + gazeRollX;
              point[3]=face.leftEye.y + gazeRollY;
            }
 else {
              point[0]=face.leftEye.x;
              point[1]=face.leftEye.y;
              point[2]=face.leftEye.x + gazeRollY;
              point[3]=face.leftEye.y + gazeRollX;
            }
            mMatrix.mapPoints(point);
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
          if (face.getRightEyeBlinkDegree() < blink_threshold) {
            if ((mDisplayRotation == 90) || (mDisplayRotation == 270)) {
              point[0]=face.rightEye.x;
              point[1]=face.rightEye.y;
              point[2]=face.rightEye.x + gazeRollX;
              point[3]=face.rightEye.y + gazeRollY;
            }
 else {
              point[0]=face.rightEye.x;
              point[1]=face.rightEye.y;
              point[2]=face.rightEye.x + gazeRollY;
              point[3]=face.rightEye.y + gazeRollX;
            }
            mMatrix.mapPoints(point);
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
        }
        if (face.mouth != null) {
          Log.e(TAG,"String_Node_Str" + face.getSmileDegree() + "String_Node_Str"+ face.getSmileScore());
          if (face.getSmileDegree() < smile_threashold_no_smile) {
            point[0]=face.mouth.x + dx - delta_x;
            point[1]=face.mouth.y;
            point[2]=face.mouth.x + dx + delta_x;
            point[3]=face.mouth.y;
            Matrix faceMatrix=new Matrix(mMatrix);
            faceMatrix.preRotate(face.getRollDirection(),face.mouth.x,face.mouth.y);
            faceMatrix.mapPoints(point);
            canvas.drawLine(point[0] + dx,point[1] + dy,point[2] + dx,point[3] + dy,mPaint);
          }
 else           if (face.getSmileDegree() < smile_threashold_small_smile) {
            int rotation_mouth=360 - mDisplayRotation;
            mRect.set(face.mouth.x - delta_x,face.mouth.y - delta_y,face.mouth.x + delta_x,face.mouth.y + delta_y);
            mMatrix.mapRect(mRect);
            mRect.offset(dx,dy);
            canvas.drawArc(mRect,rotation_mouth,180,true,mPaint);
          }
 else {
            mRect.set(face.mouth.x - delta_x,face.mouth.y - delta_y,face.mouth.x + delta_x,face.mouth.y + delta_y);
            mMatrix.mapRect(mRect);
            mRect.offset(dx,dy);
            canvas.drawOval(mRect,mPaint);
          }
        }
      }
    }
    canvas.restore();
  }
  super.onDraw(canvas);
}