Program: 54061
Project: 54061
Buggy source:
@Override protected void onDraw(@NonNull Canvas canvas){
  int startX=getScrollX() + (iconLeftBitmaps == null ? 0 : (iconOuterWidth + iconPadding));
  int endX=getScrollX() + (iconRightBitmaps == null ? getWidth() : getWidth() - iconOuterWidth - iconPadding);
  int lineStartY=getScrollY() + getHeight() - getPaddingBottom();
  paint.setAlpha(255);
  if (iconLeftBitmaps != null) {
    Bitmap icon=iconLeftBitmaps[!isInternalValid() ? 3 : !isEnabled() ? 2 : hasFocus() ? 1 : 0];
    int iconLeft=startX - iconPadding - iconOuterWidth + (iconOuterWidth - icon.getWidth()) / 2;
    int iconTop=lineStartY + bottomSpacing - iconOuterHeight + (iconOuterHeight - icon.getHeight()) / 2;
    canvas.drawBitmap(icon,iconLeft,iconTop,paint);
  }
  if (iconRightBitmaps != null) {
    Bitmap icon=iconRightBitmaps[!isInternalValid() ? 3 : !isEnabled() ? 2 : hasFocus() ? 1 : 0];
    int iconRight=endX + iconPadding + (iconOuterWidth - icon.getWidth()) / 2;
    int iconTop=lineStartY + bottomSpacing - iconOuterHeight + (iconOuterHeight - icon.getHeight()) / 2;
    canvas.drawBitmap(icon,iconRight,iconTop,paint);
  }
  if (hasFocus() && showClearButton) {
    paint.setAlpha(255);
    int buttonLeft;
    if (isRTL()) {
      buttonLeft=startX;
    }
 else {
      buttonLeft=endX - iconOuterWidth;
    }
    Bitmap clearButtonBitmap=TextUtils.isEmpty(getText()) ? closeButtonBitmaps[0] : clearButtonBitmaps[0];
    buttonLeft+=(iconOuterWidth - clearButtonBitmap.getWidth()) / 2;
    int iconTop=lineStartY + bottomSpacing - iconOuterHeight + (iconOuterHeight - clearButtonBitmap.getHeight()) / 2;
    canvas.drawBitmap(clearButtonBitmap,buttonLeft,iconTop,paint);
  }
  if (!hideUnderline) {
    lineStartY+=bottomSpacing;
    if (!isInternalValid()) {
      paint.setColor(errorColor);
      canvas.drawRect(startX,lineStartY,endX,lineStartY + getPixel(2),paint);
    }
 else     if (!isEnabled()) {
      paint.setColor(underlineColor != -1 ? underlineColor : baseColor & 0x00ffffff | 0x44000000);
      float interval=getPixel(1);
      for (float xOffset=0; xOffset < getWidth(); xOffset+=interval * 3) {
        canvas.drawRect(startX + xOffset,lineStartY,startX + xOffset + interval,lineStartY + getPixel(1),paint);
      }
    }
 else     if (hasFocus()) {
      paint.setColor(primaryColor);
      canvas.drawRect(startX,lineStartY,endX,lineStartY + getPixel(2),paint);
    }
 else {
      paint.setColor(underlineColor != -1 ? underlineColor : baseColor & 0x00ffffff | 0x1E000000);
      canvas.drawRect(startX,lineStartY,endX,lineStartY + getPixel(1),paint);
    }
  }
  textPaint.setTextSize(bottomTextSize);
  Paint.FontMetrics textMetrics=textPaint.getFontMetrics();
  float relativeHeight=-textMetrics.ascent - textMetrics.descent;
  float bottomTextPadding=bottomTextSize + textMetrics.ascent + textMetrics.descent;
  if ((hasFocus() && hasCharatersCounter()) || !isCharactersCountValid()) {
    textPaint.setColor(isCharactersCountValid() ? getCurrentHintTextColor() : errorColor);
    String charactersCounterText=getCharactersCounterText();
    canvas.drawText(charactersCounterText,isRTL() ? startX : endX - textPaint.measureText(charactersCounterText),lineStartY + bottomSpacing + relativeHeight,textPaint);
  }
  if (textLayout != null) {
    if (tempErrorText != null || ((helperTextAlwaysShown || hasFocus()) && !TextUtils.isEmpty(helperText))) {
      textPaint.setColor(tempErrorText != null ? errorColor : helperTextColor != -1 ? helperTextColor : getCurrentHintTextColor());
      canvas.save();
      canvas.translate(startX + getBottomTextLeftOffset(),lineStartY + bottomSpacing - bottomTextPadding);
      textLayout.draw(canvas);
      canvas.restore();
    }
  }
  if (floatingLabelEnabled && !TextUtils.isEmpty(floatingLabelText)) {
    textPaint.setTextSize(floatingLabelTextSize);
    textPaint.setColor((Integer)focusEvaluator.evaluate(focusFraction,floatingLabelTextColor != -1 ? floatingLabelTextColor : getCurrentHintTextColor(),primaryColor));
    float floatingLabelWidth=textPaint.measureText(floatingLabelText.toString());
    int floatingLabelStartX;
    if ((getGravity() & Gravity.RIGHT) == Gravity.RIGHT || isRTL()) {
      floatingLabelStartX=(int)(endX - floatingLabelWidth);
    }
 else     if ((getGravity() & Gravity.LEFT) == Gravity.LEFT) {
      floatingLabelStartX=startX;
    }
 else {
      floatingLabelStartX=startX + (int)(getInnerPaddingLeft() + (getWidth() - getInnerPaddingLeft() - getInnerPaddingRight()- floatingLabelWidth) / 2);
    }
    int floatingLabelStartY=innerPaddingTop + floatingLabelTextSize + floatingLabelPadding;
    int distance=floatingLabelPadding;
    int position=(int)(floatingLabelStartY - distance * (floatingLabelAlwaysShown ? 1 : floatingLabelFraction));
    int alpha=(int)((floatingLabelAlwaysShown ? 1 : floatingLabelFraction) * 0xff * (0.74f * focusFraction + 0.26f));
    textPaint.setAlpha(alpha);
    canvas.drawText(floatingLabelText.toString(),floatingLabelStartX,position,textPaint);
  }
  if (hasFocus() && singleLineEllipsis && getScrollX() != 0) {
    paint.setColor(primaryColor);
    float startY=lineStartY + bottomSpacing;
    int ellipsisStartX;
    if (isRTL()) {
      ellipsisStartX=endX;
    }
 else {
      ellipsisStartX=startX;
    }
    int signum=isRTL() ? -1 : 1;
    canvas.drawCircle(ellipsisStartX + signum * bottomEllipsisSize / 2,startY + bottomEllipsisSize / 2,bottomEllipsisSize / 2,paint);
    canvas.drawCircle(ellipsisStartX + signum * bottomEllipsisSize * 5 / 2,startY + bottomEllipsisSize / 2,bottomEllipsisSize / 2,paint);
    canvas.drawCircle(ellipsisStartX + signum * bottomEllipsisSize * 9 / 2,startY + bottomEllipsisSize / 2,bottomEllipsisSize / 2,paint);
  }
  super.onDraw(canvas);
}

Fixed version (ground truth):
@Override protected void onDraw(@NonNull Canvas canvas){
  int startX=getScrollX() + (iconLeftBitmaps == null ? 0 : (iconOuterWidth + iconPadding));
  int endX=getScrollX() + (iconRightBitmaps == null ? getWidth() : getWidth() - iconOuterWidth - iconPadding);
  int lineStartY=getScrollY() + getHeight() - getPaddingBottom();
  paint.setAlpha(255);
  if (iconLeftBitmaps != null) {
    Bitmap icon=iconLeftBitmaps[!isInternalValid() ? 3 : !isEnabled() ? 2 : hasFocus() ? 1 : 0];
    int iconLeft=startX - iconPadding - iconOuterWidth + (iconOuterWidth - icon.getWidth()) / 2;
    int iconTop=lineStartY + bottomSpacing - iconOuterHeight + (iconOuterHeight - icon.getHeight()) / 2;
    canvas.drawBitmap(icon,iconLeft,iconTop,paint);
  }
  if (iconRightBitmaps != null) {
    Bitmap icon=iconRightBitmaps[!isInternalValid() ? 3 : !isEnabled() ? 2 : hasFocus() ? 1 : 0];
    int iconRight=endX + iconPadding + (iconOuterWidth - icon.getWidth()) / 2;
    int iconTop=lineStartY + bottomSpacing - iconOuterHeight + (iconOuterHeight - icon.getHeight()) / 2;
    canvas.drawBitmap(icon,iconRight,iconTop,paint);
  }
  if (hasFocus() && showClearButton) {
    paint.setAlpha(255);
    int buttonLeft;
    if (isRTL()) {
      buttonLeft=startX;
    }
 else {
      buttonLeft=endX - iconOuterWidth;
    }
    Bitmap clearButtonBitmap=TextUtils.isEmpty(getText()) ? closeButtonBitmaps[0] : clearButtonBitmaps[0];
    buttonLeft+=(iconOuterWidth - clearButtonBitmap.getWidth()) / 2;
    int iconTop=lineStartY + bottomSpacing - iconOuterHeight + (iconOuterHeight - clearButtonBitmap.getHeight()) / 2;
    canvas.drawBitmap(clearButtonBitmap,buttonLeft,iconTop,paint);
  }
  if (!hideUnderline) {
    lineStartY+=bottomSpacing;
    if (!isInternalValid()) {
      paint.setColor(errorColor);
      canvas.drawRect(startX,lineStartY,endX,lineStartY + getPixel(2),paint);
    }
 else     if (!isEnabled()) {
      paint.setColor(underlineColor != -1 ? underlineColor : baseColor & 0x00ffffff | 0x44000000);
      float interval=getPixel(1);
      for (float xOffset=0; xOffset < getWidth(); xOffset+=interval * 3) {
        canvas.drawRect(startX + xOffset,lineStartY,startX + xOffset + interval,lineStartY + getPixel(1),paint);
      }
    }
 else     if (hasFocus()) {
      paint.setColor(primaryColor);
      canvas.drawRect(startX,lineStartY,endX,lineStartY + getPixel(2),paint);
    }
 else {
      paint.setColor(underlineColor != -1 ? underlineColor : baseColor & 0x00ffffff | 0x1E000000);
      canvas.drawRect(startX,lineStartY,endX,lineStartY + getPixel(1),paint);
    }
  }
  textPaint.setTextSize(bottomTextSize);
  Paint.FontMetrics textMetrics=textPaint.getFontMetrics();
  float relativeHeight=-textMetrics.ascent - textMetrics.descent;
  float bottomTextPadding=bottomTextSize + textMetrics.ascent + textMetrics.descent;
  if ((hasFocus() && hasCharatersCounter()) || !isCharactersCountValid()) {
    textPaint.setColor(isCharactersCountValid() ? getCurrentHintTextColor() : errorColor);
    String charactersCounterText=getCharactersCounterText();
    canvas.drawText(charactersCounterText,isRTL() ? startX : endX - textPaint.measureText(charactersCounterText),lineStartY + bottomSpacing + relativeHeight,textPaint);
  }
  if (textLayout != null) {
    if (tempErrorText != null || ((helperTextAlwaysShown || hasFocus()) && !TextUtils.isEmpty(helperText))) {
      textPaint.setColor(tempErrorText != null ? errorColor : helperTextColor != -1 ? helperTextColor : getCurrentHintTextColor());
      canvas.save();
      canvas.translate(startX + getBottomTextLeftOffset(),lineStartY + bottomSpacing - bottomTextPadding);
      textLayout.draw(canvas);
      canvas.restore();
    }
  }
  if (floatingLabelEnabled && !TextUtils.isEmpty(floatingLabelText)) {
    textPaint.setTextSize(floatingLabelTextSize);
    textPaint.setColor((Integer)focusEvaluator.evaluate(focusFraction,floatingLabelTextColor != -1 ? floatingLabelTextColor : getCurrentHintTextColor(),primaryColor));
    float floatingLabelWidth=textPaint.measureText(floatingLabelText.toString());
    int floatingLabelStartX;
    if ((getGravity() & Gravity.RIGHT) == Gravity.RIGHT || isRTL()) {
      floatingLabelStartX=(int)(endX - floatingLabelWidth);
    }
 else     if ((getGravity() & Gravity.LEFT) == Gravity.LEFT) {
      floatingLabelStartX=startX;
    }
 else {
      floatingLabelStartX=startX + (int)(getInnerPaddingLeft() + (getWidth() - getInnerPaddingLeft() - getInnerPaddingRight()- floatingLabelWidth) / 2);
    }
    int floatingLabelStartY=innerPaddingTop + floatingLabelTextSize + floatingLabelPadding;
    int distance=floatingLabelPadding;
    int position=(int)(floatingLabelStartY - distance * (floatingLabelAlwaysShown ? 1 : floatingLabelFraction));
    int alpha=(int)((floatingLabelAlwaysShown ? 1 : floatingLabelFraction) * 0xff * (floatingLabelTextColor != -1 ? 1 : (0.74f * focusFraction + 0.26f)));
    textPaint.setAlpha(alpha);
    canvas.drawText(floatingLabelText.toString(),floatingLabelStartX,position,textPaint);
  }
  if (hasFocus() && singleLineEllipsis && getScrollX() != 0) {
    paint.setColor(primaryColor);
    float startY=lineStartY + bottomSpacing;
    int ellipsisStartX;
    if (isRTL()) {
      ellipsisStartX=endX;
    }
 else {
      ellipsisStartX=startX;
    }
    int signum=isRTL() ? -1 : 1;
    canvas.drawCircle(ellipsisStartX + signum * bottomEllipsisSize / 2,startY + bottomEllipsisSize / 2,bottomEllipsisSize / 2,paint);
    canvas.drawCircle(ellipsisStartX + signum * bottomEllipsisSize * 5 / 2,startY + bottomEllipsisSize / 2,bottomEllipsisSize / 2,paint);
    canvas.drawCircle(ellipsisStartX + signum * bottomEllipsisSize * 9 / 2,startY + bottomEllipsisSize / 2,bottomEllipsisSize / 2,paint);
  }
  super.onDraw(canvas);
}