Program: 191960
Project: 191960
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  boolean hasFixedHeight=heightMode == MeasureSpec.EXACTLY;
  boolean isHeightLimited=heightMode == MeasureSpec.AT_MOST;
  int maxSize=Integer.MAX_VALUE;
  int width=MeasureSpec.getSize(widthMeasureSpec);
  if (hasFixedHeight || isHeightLimited) {
    maxSize=MeasureSpec.getSize(heightMeasureSpec);
  }
  int maxChildHeight=0;
  if (mExpandedChild != null) {
    int size=Math.min(maxSize,mNotificationMaxHeight);
    ViewGroup.LayoutParams layoutParams=mExpandedChild.getLayoutParams();
    if (layoutParams.height >= 0) {
      size=Math.min(maxSize,layoutParams.height);
    }
    int spec=size == Integer.MAX_VALUE ? MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED) : MeasureSpec.makeMeasureSpec(size,MeasureSpec.AT_MOST);
    mExpandedChild.measure(widthMeasureSpec,spec);
    maxChildHeight=Math.max(maxChildHeight,mExpandedChild.getMeasuredHeight());
  }
  if (mContractedChild != null) {
    int heightSpec;
    int size=Math.min(maxSize,mSmallHeight);
    if (shouldContractedBeFixedSize()) {
      heightSpec=MeasureSpec.makeMeasureSpec(size,MeasureSpec.EXACTLY);
    }
 else {
      heightSpec=MeasureSpec.makeMeasureSpec(size,MeasureSpec.AT_MOST);
    }
    mContractedChild.measure(widthMeasureSpec,heightSpec);
    int measuredHeight=mContractedChild.getMeasuredHeight();
    if (measuredHeight < mMinContractedHeight) {
      heightSpec=MeasureSpec.makeMeasureSpec(mMinContractedHeight,MeasureSpec.EXACTLY);
      mContractedChild.measure(widthMeasureSpec,heightSpec);
    }
    maxChildHeight=Math.max(maxChildHeight,measuredHeight);
    if (updateContractedHeaderWidth()) {
      mContractedChild.measure(widthMeasureSpec,heightSpec);
    }
  }
  if (mHeadsUpChild != null) {
    int size=Math.min(maxSize,mHeadsUpHeight);
    ViewGroup.LayoutParams layoutParams=mHeadsUpChild.getLayoutParams();
    if (layoutParams.height >= 0) {
      size=Math.min(size,layoutParams.height);
    }
    mHeadsUpChild.measure(widthMeasureSpec,MeasureSpec.makeMeasureSpec(size,MeasureSpec.AT_MOST));
    maxChildHeight=Math.max(maxChildHeight,mHeadsUpChild.getMeasuredHeight());
  }
  if (mSingleLineView != null) {
    int singleLineWidthSpec=widthMeasureSpec;
    if (mSingleLineWidthIndention != 0 && MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED) {
      singleLineWidthSpec=MeasureSpec.makeMeasureSpec(width - mSingleLineWidthIndention + mSingleLineView.getPaddingEnd(),MeasureSpec.AT_MOST);
    }
    mSingleLineView.measure(singleLineWidthSpec,MeasureSpec.makeMeasureSpec(maxSize,MeasureSpec.AT_MOST));
    maxChildHeight=Math.max(maxChildHeight,mSingleLineView.getMeasuredHeight());
  }
  int ownHeight=Math.min(maxChildHeight,maxSize);
  setMeasuredDimension(width,ownHeight);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  boolean hasFixedHeight=heightMode == MeasureSpec.EXACTLY;
  boolean isHeightLimited=heightMode == MeasureSpec.AT_MOST;
  int maxSize=Integer.MAX_VALUE;
  int width=MeasureSpec.getSize(widthMeasureSpec);
  if (hasFixedHeight || isHeightLimited) {
    maxSize=MeasureSpec.getSize(heightMeasureSpec);
  }
  int maxChildHeight=0;
  if (mExpandedChild != null) {
    int size=Math.min(maxSize,mNotificationMaxHeight);
    ViewGroup.LayoutParams layoutParams=mExpandedChild.getLayoutParams();
    if (layoutParams.height >= 0) {
      size=Math.min(maxSize,layoutParams.height);
    }
    int spec=size == Integer.MAX_VALUE ? MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED) : MeasureSpec.makeMeasureSpec(size,MeasureSpec.AT_MOST);
    mExpandedChild.measure(widthMeasureSpec,spec);
    maxChildHeight=Math.max(maxChildHeight,mExpandedChild.getMeasuredHeight());
  }
  if (mContractedChild != null) {
    int heightSpec;
    int size=Math.min(maxSize,mSmallHeight);
    if (shouldContractedBeFixedSize()) {
      heightSpec=MeasureSpec.makeMeasureSpec(size,MeasureSpec.EXACTLY);
    }
 else {
      heightSpec=MeasureSpec.makeMeasureSpec(size,MeasureSpec.AT_MOST);
    }
    mContractedChild.measure(widthMeasureSpec,heightSpec);
    int measuredHeight=mContractedChild.getMeasuredHeight();
    if (measuredHeight < mMinContractedHeight) {
      heightSpec=MeasureSpec.makeMeasureSpec(mMinContractedHeight,MeasureSpec.EXACTLY);
      mContractedChild.measure(widthMeasureSpec,heightSpec);
    }
    maxChildHeight=Math.max(maxChildHeight,measuredHeight);
    if (updateContractedHeaderWidth()) {
      mContractedChild.measure(widthMeasureSpec,heightSpec);
    }
    if (mExpandedChild != null && mContractedChild.getMeasuredHeight() > mExpandedChild.getMeasuredHeight()) {
      heightSpec=MeasureSpec.makeMeasureSpec(mContractedChild.getMeasuredHeight(),MeasureSpec.EXACTLY);
      mExpandedChild.measure(widthMeasureSpec,heightSpec);
    }
  }
  if (mHeadsUpChild != null) {
    int size=Math.min(maxSize,mHeadsUpHeight);
    ViewGroup.LayoutParams layoutParams=mHeadsUpChild.getLayoutParams();
    if (layoutParams.height >= 0) {
      size=Math.min(size,layoutParams.height);
    }
    mHeadsUpChild.measure(widthMeasureSpec,MeasureSpec.makeMeasureSpec(size,MeasureSpec.AT_MOST));
    maxChildHeight=Math.max(maxChildHeight,mHeadsUpChild.getMeasuredHeight());
  }
  if (mSingleLineView != null) {
    int singleLineWidthSpec=widthMeasureSpec;
    if (mSingleLineWidthIndention != 0 && MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED) {
      singleLineWidthSpec=MeasureSpec.makeMeasureSpec(width - mSingleLineWidthIndention + mSingleLineView.getPaddingEnd(),MeasureSpec.AT_MOST);
    }
    mSingleLineView.measure(singleLineWidthSpec,MeasureSpec.makeMeasureSpec(maxSize,MeasureSpec.AT_MOST));
    maxChildHeight=Math.max(maxChildHeight,mSingleLineView.getMeasuredHeight());
  }
  int ownHeight=Math.min(maxChildHeight,maxSize);
  setMeasuredDimension(width,ownHeight);
}