Program: 171230
Project: 171230
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int widthMode=MeasureSpec.getMode(widthMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  int widthSize=UIUtil.getRealScreenWidth(mActivity);
  int heightSize=UIUtil.getRealScreenHeight(mActivity);
  if (widthMode != MeasureSpec.EXACTLY) {
    if (isInEditMode()) {
      if (widthMode == MeasureSpec.AT_MOST) {
        widthMode=MeasureSpec.EXACTLY;
      }
 else       if (widthMode == MeasureSpec.UNSPECIFIED) {
        widthMode=MeasureSpec.EXACTLY;
        widthSize=300;
      }
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
 else   if (heightMode == MeasureSpec.UNSPECIFIED) {
    if (isInEditMode()) {
      if (heightMode == MeasureSpec.UNSPECIFIED) {
        heightMode=MeasureSpec.AT_MOST;
        heightSize=300;
      }
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  int layoutHeight=0;
  int maxLayoutHeight=-1;
switch (heightMode) {
case MeasureSpec.EXACTLY:
    layoutHeight=maxLayoutHeight=heightSize - getPaddingTop() - getPaddingBottom();
  break;
case MeasureSpec.AT_MOST:
maxLayoutHeight=heightSize - getPaddingTop() - getPaddingBottom();
break;
}
if (!mIsNavigationBarOverlap && UIUtil.isPortrait(mActivity)) {
maxLayoutHeight-=UIUtil.getNavigationBarHeight(mActivity);
}
if (mIsNavigationBarOverlap && !UIUtil.isPortrait(mActivity)) {
widthSize+=UIUtil.getNavigationBarHeight(mActivity);
}
float weightSum=0;
boolean canSlide=false;
final int widthAvailable=widthSize - getPaddingLeft() - getPaddingRight();
int widthRemaining=widthAvailable;
final int childCount=getChildCount();
if (childCount > 2) {
Log.e(TAG,"String_Node_Str");
}
mSlideableView=null;
for (int i=0; i < childCount; i++) {
final View child=getChildAt(i);
final LayoutParams lp=(LayoutParams)child.getLayoutParams();
if (child.getVisibility() == GONE) {
lp.dimWhenOffset=false;
continue;
}
if (lp.weight > 0) {
weightSum+=lp.weight;
if (lp.width == 0) continue;
}
int childWidthSpec;
final int horizontalMargin=lp.leftMargin + lp.rightMargin;
if (lp.width == LayoutParams.WRAP_CONTENT) {
childWidthSpec=MeasureSpec.makeMeasureSpec(widthAvailable - horizontalMargin,MeasureSpec.AT_MOST);
}
 else if (lp.width == LayoutParams.MATCH_PARENT) {
childWidthSpec=MeasureSpec.makeMeasureSpec(widthAvailable - horizontalMargin,MeasureSpec.EXACTLY);
}
 else {
childWidthSpec=MeasureSpec.makeMeasureSpec(lp.width,MeasureSpec.EXACTLY);
}
int childHeightSpec;
if (lp.height == LayoutParams.WRAP_CONTENT) {
childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.AT_MOST);
}
 else if (lp.height == LayoutParams.MATCH_PARENT) {
childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.EXACTLY);
}
 else {
childHeightSpec=MeasureSpec.makeMeasureSpec(lp.height,MeasureSpec.EXACTLY);
}
child.measure(childWidthSpec,childHeightSpec);
final int childWidth=child.getMeasuredWidth();
final int childHeight=child.getMeasuredHeight();
if (heightMode == MeasureSpec.AT_MOST && childHeight > layoutHeight) {
layoutHeight=Math.min(childHeight,maxLayoutHeight);
}
widthRemaining-=childWidth;
canSlide|=lp.slideable=widthRemaining < 0;
if (lp.slideable) {
mSlideableView=child;
}
}
if (canSlide || weightSum > 0) {
final int fixedPanelWidthLimit=widthAvailable - mOverhangSize;
for (int i=0; i < childCount; i++) {
final View child=getChildAt(i);
if (child.getVisibility() == GONE) {
continue;
}
final LayoutParams lp=(LayoutParams)child.getLayoutParams();
if (child.getVisibility() == GONE) {
continue;
}
final boolean skippedFirstPass=lp.width == 0 && lp.weight > 0;
final int measuredWidth=skippedFirstPass ? 0 : child.getMeasuredWidth();
if (canSlide && child != mSlideableView) {
if (lp.width < 0 && (measuredWidth > fixedPanelWidthLimit || lp.weight > 0)) {
  final int childHeightSpec;
  if (skippedFirstPass) {
    if (lp.height == LayoutParams.WRAP_CONTENT) {
      childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.AT_MOST);
    }
 else     if (lp.height == LayoutParams.MATCH_PARENT) {
      childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.EXACTLY);
    }
 else {
      childHeightSpec=MeasureSpec.makeMeasureSpec(lp.height,MeasureSpec.EXACTLY);
    }
  }
 else {
    childHeightSpec=MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(),MeasureSpec.EXACTLY);
  }
  final int childWidthSpec=MeasureSpec.makeMeasureSpec(fixedPanelWidthLimit,MeasureSpec.EXACTLY);
  child.measure(childWidthSpec,childHeightSpec);
}
}
 else if (lp.weight > 0) {
int childHeightSpec;
if (lp.width == 0) {
  if (lp.height == LayoutParams.WRAP_CONTENT) {
    childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.AT_MOST);
  }
 else   if (lp.height == LayoutParams.MATCH_PARENT) {
    childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.EXACTLY);
  }
 else {
    childHeightSpec=MeasureSpec.makeMeasureSpec(lp.height,MeasureSpec.EXACTLY);
  }
}
 else {
  childHeightSpec=MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(),MeasureSpec.EXACTLY);
}
if (canSlide) {
  final int horizontalMargin=lp.leftMargin + lp.rightMargin;
  final int newWidth=widthAvailable - horizontalMargin;
  final int childWidthSpec=MeasureSpec.makeMeasureSpec(newWidth,MeasureSpec.EXACTLY);
  if (measuredWidth != newWidth) {
    child.measure(childWidthSpec,childHeightSpec);
  }
}
 else {
  final int widthToDistribute=Math.max(0,widthRemaining);
  final int addedWidth=(int)(lp.weight * widthToDistribute / weightSum);
  final int childWidthSpec=MeasureSpec.makeMeasureSpec(measuredWidth + addedWidth,MeasureSpec.EXACTLY);
  child.measure(childWidthSpec,childHeightSpec);
}
}
}
}
final int measuredWidth=widthSize;
final int measuredHeight=layoutHeight + getPaddingTop() + getPaddingBottom();
setMeasuredDimension(measuredWidth,measuredHeight);
mCanSlide=canSlide;
if (mDragHelper.getViewDragState() != ViewDragHelper.STATE_IDLE && !canSlide) {
mDragHelper.abort();
}
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int widthMode=MeasureSpec.getMode(widthMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  int widthSize=MeasureSpec.getSize(widthMeasureSpec);
  int heightSize=MeasureSpec.getSize(heightMeasureSpec);
  if (widthMode != MeasureSpec.EXACTLY) {
    if (isInEditMode()) {
      if (widthMode == MeasureSpec.AT_MOST) {
        widthMode=MeasureSpec.EXACTLY;
      }
 else       if (widthMode == MeasureSpec.UNSPECIFIED) {
        widthMode=MeasureSpec.EXACTLY;
        widthSize=300;
      }
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
 else   if (heightMode == MeasureSpec.UNSPECIFIED) {
    if (isInEditMode()) {
      if (heightMode == MeasureSpec.UNSPECIFIED) {
        heightMode=MeasureSpec.AT_MOST;
        heightSize=300;
      }
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  int layoutHeight=0;
  int maxLayoutHeight=0;
switch (heightMode) {
case MeasureSpec.EXACTLY:
    layoutHeight=maxLayoutHeight=heightSize - getPaddingTop() - getPaddingBottom();
  break;
case MeasureSpec.AT_MOST:
maxLayoutHeight=heightSize - getPaddingTop() - getPaddingBottom();
break;
}
float weightSum=0;
boolean canSlide=false;
final int widthAvailable=widthSize - getPaddingLeft() - getPaddingRight();
int widthRemaining=widthAvailable;
final int childCount=getChildCount();
if (childCount > 2) {
Log.e(TAG,"String_Node_Str");
}
mSlideableView=null;
for (int i=0; i < childCount; i++) {
final View child=getChildAt(i);
final LayoutParams lp=(LayoutParams)child.getLayoutParams();
if (child.getVisibility() == GONE) {
lp.dimWhenOffset=false;
continue;
}
if (lp.weight > 0) {
weightSum+=lp.weight;
if (lp.width == 0) continue;
}
int childWidthSpec;
final int horizontalMargin=lp.leftMargin + lp.rightMargin;
if (lp.width == LayoutParams.WRAP_CONTENT) {
childWidthSpec=MeasureSpec.makeMeasureSpec(widthAvailable - horizontalMargin,MeasureSpec.AT_MOST);
}
 else if (lp.width == LayoutParams.MATCH_PARENT) {
childWidthSpec=MeasureSpec.makeMeasureSpec(widthAvailable - horizontalMargin,MeasureSpec.EXACTLY);
}
 else {
childWidthSpec=MeasureSpec.makeMeasureSpec(lp.width,MeasureSpec.EXACTLY);
}
int childHeightSpec;
if (lp.height == LayoutParams.WRAP_CONTENT) {
childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.AT_MOST);
}
 else if (lp.height == LayoutParams.MATCH_PARENT) {
childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.EXACTLY);
}
 else {
childHeightSpec=MeasureSpec.makeMeasureSpec(lp.height,MeasureSpec.EXACTLY);
}
child.measure(childWidthSpec,childHeightSpec);
final int childWidth=child.getMeasuredWidth();
final int childHeight=child.getMeasuredHeight();
if (heightMode == MeasureSpec.AT_MOST && childHeight > layoutHeight) {
layoutHeight=Math.min(childHeight,maxLayoutHeight);
}
widthRemaining-=childWidth;
canSlide|=lp.slideable=widthRemaining < 0;
if (lp.slideable) {
mSlideableView=child;
}
}
if (canSlide || weightSum > 0) {
final int fixedPanelWidthLimit=widthAvailable - mOverhangSize;
for (int i=0; i < childCount; i++) {
final View child=getChildAt(i);
if (child.getVisibility() == GONE) {
continue;
}
final LayoutParams lp=(LayoutParams)child.getLayoutParams();
if (child.getVisibility() == GONE) {
continue;
}
final boolean skippedFirstPass=lp.width == 0 && lp.weight > 0;
final int measuredWidth=skippedFirstPass ? 0 : child.getMeasuredWidth();
if (canSlide && child != mSlideableView) {
if (lp.width < 0 && (measuredWidth > fixedPanelWidthLimit || lp.weight > 0)) {
  final int childHeightSpec;
  if (skippedFirstPass) {
    if (lp.height == LayoutParams.WRAP_CONTENT) {
      childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.AT_MOST);
    }
 else     if (lp.height == LayoutParams.MATCH_PARENT) {
      childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.EXACTLY);
    }
 else {
      childHeightSpec=MeasureSpec.makeMeasureSpec(lp.height,MeasureSpec.EXACTLY);
    }
  }
 else {
    childHeightSpec=MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(),MeasureSpec.EXACTLY);
  }
  final int childWidthSpec=MeasureSpec.makeMeasureSpec(fixedPanelWidthLimit,MeasureSpec.EXACTLY);
  child.measure(childWidthSpec,childHeightSpec);
}
}
 else if (lp.weight > 0) {
int childHeightSpec;
if (lp.width == 0) {
  if (lp.height == LayoutParams.WRAP_CONTENT) {
    childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.AT_MOST);
  }
 else   if (lp.height == LayoutParams.MATCH_PARENT) {
    childHeightSpec=MeasureSpec.makeMeasureSpec(maxLayoutHeight,MeasureSpec.EXACTLY);
  }
 else {
    childHeightSpec=MeasureSpec.makeMeasureSpec(lp.height,MeasureSpec.EXACTLY);
  }
}
 else {
  childHeightSpec=MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(),MeasureSpec.EXACTLY);
}
if (canSlide) {
  final int horizontalMargin=lp.leftMargin + lp.rightMargin;
  final int newWidth=widthAvailable - horizontalMargin;
  final int childWidthSpec=MeasureSpec.makeMeasureSpec(newWidth,MeasureSpec.EXACTLY);
  if (measuredWidth != newWidth) {
    child.measure(childWidthSpec,childHeightSpec);
  }
}
 else {
  final int widthToDistribute=Math.max(0,widthRemaining);
  final int addedWidth=(int)(lp.weight * widthToDistribute / weightSum);
  final int childWidthSpec=MeasureSpec.makeMeasureSpec(measuredWidth + addedWidth,MeasureSpec.EXACTLY);
  child.measure(childWidthSpec,childHeightSpec);
}
}
}
}
final int measuredWidth=widthSize;
final int measuredHeight=layoutHeight + getPaddingTop() + getPaddingBottom();
setMeasuredDimension(measuredWidth,measuredHeight);
mCanSlide=canSlide;
if (mDragHelper.getViewDragState() != ViewDragHelper.STATE_IDLE && !canSlide) {
mDragHelper.abort();
}
}