Program: 192534
Project: 192534
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int mode=MeasureSpec.getMode(widthMeasureSpec);
  boolean hasIcon=mRightIcon.getVisibility() != GONE;
  if (hasIcon && mode != MeasureSpec.UNSPECIFIED) {
    measureChild(mActions,widthMeasureSpec,heightMeasureSpec);
    int size=MeasureSpec.getSize(widthMeasureSpec);
    size=size - mActions.getMeasuredWidth();
    ViewGroup.MarginLayoutParams layoutParams=(MarginLayoutParams)mRightIcon.getLayoutParams();
    int imageEndMargin=layoutParams.getMarginEnd();
    size-=imageEndMargin;
    size=Math.min(size,mMaxImageSize);
    size=Math.max(size,mRightIcon.getMinimumWidth());
    layoutParams.width=size;
    layoutParams.height=size;
    mRightIcon.setLayoutParams(layoutParams);
    ViewGroup.MarginLayoutParams mainParams=(MarginLayoutParams)mMainColumn.getLayoutParams();
    int marginEnd=size + imageEndMargin + mNotificationContentMarginEnd;
    if (marginEnd != mainParams.getMarginEnd()) {
      mainParams.setMarginEnd(marginEnd);
      mMainColumn.setLayoutParams(mainParams);
    }
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  ViewGroup.MarginLayoutParams iconParams=(MarginLayoutParams)mRightIcon.getLayoutParams();
  int topMargin=getMeasuredHeight() - mRightIcon.getMeasuredHeight() - iconParams.bottomMargin;
  if (!hasIcon || topMargin >= mImageMinTopMargin) {
    resetHeaderIndention();
  }
 else {
    int paddingEnd=mNotificationContentImageMarginEnd;
    ViewGroup.MarginLayoutParams headerParams=(MarginLayoutParams)mHeader.getLayoutParams();
    headerParams.setMarginEnd(mRightIcon.getMeasuredWidth() + iconParams.getMarginEnd());
    if (mHeader.getPaddingEnd() != paddingEnd) {
      mHeader.setPadding(isLayoutRtl() ? paddingEnd : mHeader.getPaddingLeft(),mHeader.getPaddingTop(),isLayoutRtl() ? mHeader.getPaddingLeft() : paddingEnd,mHeader.getPaddingBottom());
      mHeader.setLayoutParams(headerParams);
    }
  }
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int mode=MeasureSpec.getMode(widthMeasureSpec);
  boolean hasIcon=mRightIcon.getVisibility() != GONE;
  if (hasIcon && mode != MeasureSpec.UNSPECIFIED) {
    measureChild(mActions,widthMeasureSpec,heightMeasureSpec);
    int size=MeasureSpec.getSize(widthMeasureSpec);
    size=size - mActions.getMeasuredWidth();
    ViewGroup.MarginLayoutParams layoutParams=(MarginLayoutParams)mRightIcon.getLayoutParams();
    int imageEndMargin=layoutParams.getMarginEnd();
    size-=imageEndMargin;
    size=Math.min(size,mMaxImageSize);
    size=Math.max(size,mRightIcon.getMinimumWidth());
    layoutParams.width=size;
    layoutParams.height=size;
    mRightIcon.setLayoutParams(layoutParams);
    ViewGroup.MarginLayoutParams mainParams=(MarginLayoutParams)mMainColumn.getLayoutParams();
    int marginEnd=size + imageEndMargin + mNotificationContentMarginEnd;
    if (marginEnd != mainParams.getMarginEnd()) {
      mainParams.setMarginEnd(marginEnd);
      mMainColumn.setLayoutParams(mainParams);
    }
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  ViewGroup.MarginLayoutParams iconParams=(MarginLayoutParams)mRightIcon.getLayoutParams();
  int topMargin=getMeasuredHeight() - mRightIcon.getMeasuredHeight() - iconParams.bottomMargin;
  boolean reMeasure=false;
  if (!hasIcon || topMargin >= mImageMinTopMargin) {
    reMeasure=resetHeaderIndention();
  }
 else {
    int paddingEnd=mNotificationContentImageMarginEnd;
    ViewGroup.MarginLayoutParams headerParams=(MarginLayoutParams)mHeader.getLayoutParams();
    int newMarginEnd=mRightIcon.getMeasuredWidth() + iconParams.getMarginEnd();
    if (headerParams.getMarginEnd() != newMarginEnd) {
      headerParams.setMarginEnd(newMarginEnd);
      mHeader.setLayoutParams(headerParams);
      reMeasure=true;
    }
    if (mHeader.getPaddingEnd() != paddingEnd) {
      mHeader.setPaddingRelative(mHeader.getPaddingStart(),mHeader.getPaddingTop(),paddingEnd,mHeader.getPaddingBottom());
      reMeasure=true;
    }
  }
  if (reMeasure) {
    measureChildWithMargins(mHeader,widthMeasureSpec,0,heightMeasureSpec,0);
  }
}