Program: 192852
Project: 192852
Buggy source:
/** 
 * Called when the task view frame changes, allowing us to move the contents of the header to match the frame changes.
 */
public void onTaskViewSizeChanged(int width,int height){
  if (mTaskViewRect.width() == width && mTaskViewRect.height() == height) {
    return;
  }
  mTaskViewRect.set(0,0,width,height);
  boolean updateMoveTaskButton=mMoveTaskButton.getVisibility() != View.GONE;
  boolean isFreeformTask=(mTask != null) && mTask.isFreeformTask();
  int appIconWidth=mIconView.getMeasuredWidth();
  int activityDescWidth=(mTask != null) ? (int)mTitleView.getPaint().measureText(mTask.title) : mTitleView.getMeasuredWidth();
  int dismissIconWidth=mDismissButton.getMeasuredWidth();
  int moveTaskIconWidth=mMoveTaskButton.getVisibility() == View.VISIBLE ? mMoveTaskButton.getMeasuredWidth() : 0;
  if (isFreeformTask && width < (appIconWidth + dismissIconWidth)) {
    mTitleView.setVisibility(View.INVISIBLE);
    if (updateMoveTaskButton) {
      mMoveTaskButton.setVisibility(View.INVISIBLE);
    }
    mDismissButton.setVisibility(View.INVISIBLE);
  }
 else   if (isFreeformTask && width < (appIconWidth + dismissIconWidth + moveTaskIconWidth)) {
    mTitleView.setVisibility(View.INVISIBLE);
    if (updateMoveTaskButton) {
      mMoveTaskButton.setVisibility(View.INVISIBLE);
    }
    mDismissButton.setVisibility(View.VISIBLE);
  }
 else   if (isFreeformTask && width < (appIconWidth + dismissIconWidth + moveTaskIconWidth+ activityDescWidth)) {
    mTitleView.setVisibility(View.INVISIBLE);
    if (updateMoveTaskButton) {
      mMoveTaskButton.setVisibility(View.VISIBLE);
    }
    mDismissButton.setVisibility(View.VISIBLE);
  }
 else {
    mTitleView.setVisibility(View.VISIBLE);
    if (updateMoveTaskButton) {
      mMoveTaskButton.setVisibility(View.VISIBLE);
    }
    mDismissButton.setVisibility(View.VISIBLE);
  }
  if (updateMoveTaskButton) {
    mMoveTaskButton.setTranslationX(width - getMeasuredWidth());
  }
  mDismissButton.setTranslationX(width - getMeasuredWidth());
  invalidate();
}

Fixed version (ground truth):
/** 
 * Called when the task view frame changes, allowing us to move the contents of the header to match the frame changes.
 */
public void onTaskViewSizeChanged(int width,int height){
  mTaskViewRect.set(0,0,width,height);
  boolean updateMoveTaskButton=mMoveTaskButton.getVisibility() != View.GONE;
  boolean isFreeformTask=(mTask != null) && mTask.isFreeformTask();
  int appIconWidth=mIconView.getMeasuredWidth();
  int activityDescWidth=(mTask != null) ? (int)mTitleView.getPaint().measureText(mTask.title) : mTitleView.getMeasuredWidth();
  int dismissIconWidth=mDismissButton.getMeasuredWidth();
  int moveTaskIconWidth=mMoveTaskButton.getVisibility() == View.VISIBLE ? mMoveTaskButton.getMeasuredWidth() : 0;
  if (isFreeformTask && width < (appIconWidth + dismissIconWidth)) {
    mTitleView.setVisibility(View.INVISIBLE);
    if (updateMoveTaskButton) {
      mMoveTaskButton.setVisibility(View.INVISIBLE);
    }
    mDismissButton.setVisibility(View.INVISIBLE);
  }
 else   if (isFreeformTask && width < (appIconWidth + dismissIconWidth + moveTaskIconWidth)) {
    mTitleView.setVisibility(View.INVISIBLE);
    if (updateMoveTaskButton) {
      mMoveTaskButton.setVisibility(View.INVISIBLE);
    }
    mDismissButton.setVisibility(View.VISIBLE);
  }
 else   if (isFreeformTask && width < (appIconWidth + dismissIconWidth + moveTaskIconWidth+ activityDescWidth)) {
    mTitleView.setVisibility(View.INVISIBLE);
    if (updateMoveTaskButton) {
      mMoveTaskButton.setVisibility(View.VISIBLE);
    }
    mDismissButton.setVisibility(View.VISIBLE);
  }
 else {
    mTitleView.setVisibility(View.VISIBLE);
    if (updateMoveTaskButton) {
      mMoveTaskButton.setVisibility(View.VISIBLE);
    }
    mDismissButton.setVisibility(View.VISIBLE);
  }
  if (updateMoveTaskButton) {
    mMoveTaskButton.setTranslationX(width - getMeasuredWidth());
  }
  mDismissButton.setTranslationX(width - getMeasuredWidth());
  invalidate();
}