Program: 110295
Project: 110295
Buggy source:
private void setupTextLayout(){
  int parentWidth=parentRight - parentLeft;
  int parentHeight=parentBottom - parentTop;
  textPaint.setTextSize(textSizePx);
  int textPaddingX=(int)(textSizePx * INNER_PADDING_RATIO + 0.5f);
  int availableWidth=parentWidth - textPaddingX * 2;
  if (cueSize != Cue.DIMEN_UNSET) {
    availableWidth=(int)(availableWidth * cueSize);
  }
  if (availableWidth <= 0) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  Alignment textAlignment=cueTextAlignment == null ? Alignment.ALIGN_CENTER : cueTextAlignment;
  textLayout=new StaticLayout(cueText,textPaint,availableWidth,textAlignment,spacingMult,spacingAdd,true);
  int textHeight=textLayout.getHeight();
  int textWidth=0;
  int lineCount=textLayout.getLineCount();
  for (int i=0; i < lineCount; i++) {
    textWidth=Math.max((int)Math.ceil(textLayout.getLineWidth(i)),textWidth);
  }
  if (cueSize != Cue.DIMEN_UNSET && textWidth < availableWidth) {
    textWidth=availableWidth;
  }
  textWidth+=textPaddingX * 2;
  int textLeft;
  int textRight;
  if (cuePosition != Cue.DIMEN_UNSET) {
    int anchorPosition=Math.round(parentWidth * cuePosition) + parentLeft;
    textLeft=cuePositionAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textWidth : cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textWidth) / 2 : anchorPosition;
    textLeft=Math.max(textLeft,parentLeft);
    textRight=Math.min(textLeft + textWidth,parentRight);
  }
 else {
    textLeft=(parentWidth - textWidth) / 2;
    textRight=textLeft + textWidth;
  }
  int textTop;
  if (cueLine != Cue.DIMEN_UNSET) {
    int anchorPosition;
    if (cueLineType == Cue.LINE_TYPE_FRACTION) {
      anchorPosition=Math.round(parentHeight * cueLine) + parentTop;
    }
 else {
      int firstLineHeight=textLayout.getLineBottom(0) - textLayout.getLineTop(0);
      if (cueLine >= 0) {
        anchorPosition=Math.round(cueLine * firstLineHeight) + parentTop;
      }
 else {
        anchorPosition=Math.round(cueLine * firstLineHeight) + parentBottom;
      }
    }
    textTop=cueLineAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textHeight : cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textHeight) / 2 : anchorPosition;
    if (textTop + textHeight > parentBottom) {
      textTop=parentBottom - textHeight;
    }
 else     if (textTop < parentTop) {
      textTop=parentTop;
    }
  }
 else {
    textTop=parentBottom - textHeight - (int)(parentHeight * bottomPaddingFraction);
  }
  textWidth=textRight - textLeft;
  this.textLayout=new StaticLayout(cueText,textPaint,textWidth,textAlignment,spacingMult,spacingAdd,true);
  this.textLeft=textLeft;
  this.textTop=textTop;
  this.textPaddingX=textPaddingX;
}

Fixed version (ground truth):
private void setupTextLayout(){
  int parentWidth=parentRight - parentLeft;
  int parentHeight=parentBottom - parentTop;
  textPaint.setTextSize(textSizePx);
  int textPaddingX=(int)(textSizePx * INNER_PADDING_RATIO + 0.5f);
  int availableWidth=parentWidth - textPaddingX * 2;
  if (cueSize != Cue.DIMEN_UNSET) {
    availableWidth=(int)(availableWidth * cueSize);
  }
  if (availableWidth <= 0) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  Alignment textAlignment=cueTextAlignment == null ? Alignment.ALIGN_CENTER : cueTextAlignment;
  textLayout=new StaticLayout(cueText,textPaint,availableWidth,textAlignment,spacingMult,spacingAdd,true);
  int textHeight=textLayout.getHeight();
  int textWidth=0;
  int lineCount=textLayout.getLineCount();
  for (int i=0; i < lineCount; i++) {
    textWidth=Math.max((int)Math.ceil(textLayout.getLineWidth(i)),textWidth);
  }
  if (cueSize != Cue.DIMEN_UNSET && textWidth < availableWidth) {
    textWidth=availableWidth;
  }
  textWidth+=textPaddingX * 2;
  int textLeft;
  int textRight;
  if (cuePosition != Cue.DIMEN_UNSET) {
    int anchorPosition=Math.round(parentWidth * cuePosition) + parentLeft;
    textLeft=cuePositionAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textWidth : cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textWidth) / 2 : anchorPosition;
    textLeft=Math.max(textLeft,parentLeft);
    textRight=Math.min(textLeft + textWidth,parentRight);
  }
 else {
    textLeft=(parentWidth - textWidth) / 2;
    textRight=textLeft + textWidth;
  }
  int textTop;
  if (cueLine != Cue.DIMEN_UNSET) {
    int anchorPosition;
    if (cueLineType == Cue.LINE_TYPE_FRACTION) {
      anchorPosition=Math.round(parentHeight * cueLine) + parentTop;
    }
 else {
      int firstLineHeight=textLayout.getLineBottom(0) - textLayout.getLineTop(0);
      if (cueLine >= 0) {
        anchorPosition=Math.round(cueLine * firstLineHeight) + parentTop;
      }
 else {
        anchorPosition=Math.round((cueLine + 1) * firstLineHeight) + parentBottom;
      }
    }
    textTop=cueLineAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textHeight : cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textHeight) / 2 : anchorPosition;
    if (textTop + textHeight > parentBottom) {
      textTop=parentBottom - textHeight;
    }
 else     if (textTop < parentTop) {
      textTop=parentTop;
    }
  }
 else {
    textTop=parentBottom - textHeight - (int)(parentHeight * bottomPaddingFraction);
  }
  textWidth=textRight - textLeft;
  this.textLayout=new StaticLayout(cueText,textPaint,textWidth,textAlignment,spacingMult,spacingAdd,true);
  this.textLeft=textLeft;
  this.textTop=textTop;
  this.textPaddingX=textPaddingX;
}