nus-yam/ex-repair huggingface dataset:
Program: 192240
Project: 192240
Buggy source:
/** 
 * Sends a notification indicating the bugreport has finished so use can share it.
 */
private static void sendBugreportNotification(Context context,BugreportInfo info,boolean takingScreenshot){
  addDetailsToZipFile(context,info);
  final Intent shareIntent=new Intent(INTENT_BUGREPORT_SHARE);
  shareIntent.setClass(context,BugreportProgressService.class);
  shareIntent.setAction(INTENT_BUGREPORT_SHARE);
  shareIntent.putExtra(EXTRA_ID,info.id);
  shareIntent.putExtra(EXTRA_INFO,info);
  final String title, content;
  if (takingScreenshot) {
    title=context.getString(R.string.bugreport_finished_pending_screenshot_title,info.id);
    content=context.getString(R.string.bugreport_finished_pending_screenshot_text);
  }
 else {
    title=context.getString(R.string.bugreport_finished_title,info.id);
    content=context.getString(R.string.bugreport_finished_text);
  }
  final Notification.Builder builder=newBaseNotification(context).setContentTitle(title).setTicker(title).setContentText(content).setContentIntent(PendingIntent.getService(context,info.id,shareIntent,PendingIntent.FLAG_UPDATE_CURRENT)).setDeleteIntent(newCancelIntent(context,info));
  if (!TextUtils.isEmpty(info.name)) {
    builder.setContentInfo(info.name);
  }
  Log.v(TAG,"String_Node_Str" + info.id + "String_Node_Str"+ title);
  NotificationManager.from(context).notify(TAG,info.id,builder.build());
}

Fixed version (ground truth):
/** 
 * Sends a notification indicating the bugreport has finished so use can share it.
 */
private static void sendBugreportNotification(Context context,BugreportInfo info,boolean takingScreenshot){
  addDetailsToZipFile(context,info);
  final Intent shareIntent=new Intent(INTENT_BUGREPORT_SHARE);
  shareIntent.setClass(context,BugreportProgressService.class);
  shareIntent.setAction(INTENT_BUGREPORT_SHARE);
  shareIntent.putExtra(EXTRA_ID,info.id);
  shareIntent.putExtra(EXTRA_INFO,info);
  final String title, content;
  if (takingScreenshot) {
    title=context.getString(R.string.bugreport_finished_pending_screenshot_title,info.id);
    content=context.getString(R.string.bugreport_finished_pending_screenshot_text);
  }
 else {
    title=context.getString(R.string.bugreport_finished_title,info.id);
    content=context.getString(R.string.bugreport_finished_text);
  }
  final Notification.Builder builder=newBaseNotification(context).setContentTitle(title).setTicker(title).setContentText(content).setContentIntent(PendingIntent.getService(context,info.id,shareIntent,PendingIntent.FLAG_UPDATE_CURRENT)).setDeleteIntent(newCancelIntent(context,info));
  if (!TextUtils.isEmpty(info.name)) {
    builder.setSubText(info.name);
  }
  Log.v(TAG,"String_Node_Str" + info.id + "String_Node_Str"+ title);
  NotificationManager.from(context).notify(TAG,info.id,builder.build());
}
Program: 192242
Project: 192242
Buggy source:
public void scrollTo(View v){
  ExpandableView expandableView=(ExpandableView)v;
  int positionInLinearLayout=getPositionInLinearLayout(v);
  int targetScroll=positionInLinearLayout + expandableView.getActualHeight() + mBottomInset - getHeight() + getTopPadding();
  if (mOwnScrollY < targetScroll) {
    mScroller.startScroll(mScrollX,mOwnScrollY,0,targetScroll - mOwnScrollY);
    mDontReportNextOverScroll=true;
    postInvalidateOnAnimation();
  }
}

Fixed version (ground truth):
public void scrollTo(View v){
  ExpandableView expandableView=(ExpandableView)v;
  int positionInLinearLayout=getPositionInLinearLayout(v);
  int targetScroll=positionInLinearLayout + expandableView.getActualHeight() + getImeInset() - getHeight() + getTopPadding();
  if (mOwnScrollY < targetScroll) {
    mScroller.startScroll(mScrollX,mOwnScrollY,0,targetScroll - mOwnScrollY);
    mDontReportNextOverScroll=true;
    postInvalidateOnAnimation();
  }
}
Program: 192243
Project: 192243
Buggy source:
@Override public WindowInsets onApplyWindowInsets(WindowInsets insets){
  mBottomInset=Math.max(0,insets.getSystemWindowInsetBottom() - (getRootView().getHeight() - getHeight()));
  int range=getScrollRange();
  if (mOwnScrollY > range) {
    removeCallbacks(mReclamp);
    postDelayed(mReclamp,50);
  }
  return insets;
}

Fixed version (ground truth):
@Override public WindowInsets onApplyWindowInsets(WindowInsets insets){
  mBottomInset=insets.getSystemWindowInsetBottom();
  int range=getScrollRange();
  if (mOwnScrollY > range) {
    removeCallbacks(mReclamp);
    postDelayed(mReclamp,50);
  }
  return insets;
}
Program: 192244
Project: 192244
Buggy source:
private int getScrollRange(){
  int scrollRange=0;
  ExpandableView firstChild=(ExpandableView)getFirstChildNotGone();
  if (firstChild != null) {
    int contentHeight=getContentHeight();
    scrollRange=Math.max(0,contentHeight - mMaxLayoutHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight);
    if (scrollRange > 0) {
      int firstChildMaxExpandHeight=getMaxExpandHeight(firstChild);
      scrollRange=Math.max(scrollRange,firstChildMaxExpandHeight - firstChild.getMinHeight());
    }
  }
  int imeOverlap=Math.max(0,getContentHeight() - (getHeight() - mBottomInset));
  return scrollRange + imeOverlap;
}

Fixed version (ground truth):
private int getScrollRange(){
  int contentHeight=getContentHeight();
  int scrollRange=Math.max(0,contentHeight - mMaxLayoutHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight);
  int imeInset=getImeInset();
  scrollRange+=Math.min(imeInset,Math.max(0,getContentHeight() - (getHeight() - imeInset)));
  return scrollRange;
}
Program: 192245
Project: 192245
Buggy source:
public void scrollTo(View v){
  ExpandableView expandableView=(ExpandableView)v;
  int positionInLinearLayout=getPositionInLinearLayout(v);
  int targetScroll=positionInLinearLayout + expandableView.getActualHeight() + mBottomInset - getHeight() + getTopPadding();
  if (mOwnScrollY < targetScroll) {
    mScroller.startScroll(mScrollX,mOwnScrollY,0,targetScroll - mOwnScrollY);
    mDontReportNextOverScroll=true;
    postInvalidateOnAnimation();
  }
}

Fixed version (ground truth):
public void scrollTo(View v){
  ExpandableView expandableView=(ExpandableView)v;
  int positionInLinearLayout=getPositionInLinearLayout(v);
  int targetScroll=positionInLinearLayout + expandableView.getActualHeight() + getImeInset() - getHeight() + getTopPadding();
  if (mOwnScrollY < targetScroll) {
    mScroller.startScroll(mScrollX,mOwnScrollY,0,targetScroll - mOwnScrollY);
    mDontReportNextOverScroll=true;
    postInvalidateOnAnimation();
  }
}
Program: 192246
Project: 192246
Buggy source:
@Override public WindowInsets onApplyWindowInsets(WindowInsets insets){
  mBottomInset=Math.max(0,insets.getSystemWindowInsetBottom() - (getRootView().getHeight() - getHeight()));
  int range=getScrollRange();
  if (mOwnScrollY > range) {
    removeCallbacks(mReclamp);
    postDelayed(mReclamp,50);
  }
  return insets;
}

Fixed version (ground truth):
@Override public WindowInsets onApplyWindowInsets(WindowInsets insets){
  mBottomInset=insets.getSystemWindowInsetBottom();
  int range=getScrollRange();
  if (mOwnScrollY > range) {
    removeCallbacks(mReclamp);
    postDelayed(mReclamp,50);
  }
  return insets;
}
Program: 192247
Project: 192247
Buggy source:
private int getScrollRange(){
  int scrollRange=0;
  ExpandableView firstChild=(ExpandableView)getFirstChildNotGone();
  if (firstChild != null) {
    int contentHeight=getContentHeight();
    scrollRange=Math.max(0,contentHeight - mMaxLayoutHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight);
    if (scrollRange > 0) {
      int firstChildMaxExpandHeight=getMaxExpandHeight(firstChild);
      scrollRange=Math.max(scrollRange,firstChildMaxExpandHeight - firstChild.getMinHeight());
    }
  }
  int imeOverlap=Math.max(0,getContentHeight() - (getHeight() - mBottomInset));
  return scrollRange + imeOverlap;
}

Fixed version (ground truth):
private int getScrollRange(){
  int contentHeight=getContentHeight();
  int scrollRange=Math.max(0,contentHeight - mMaxLayoutHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight);
  int imeInset=getImeInset();
  scrollRange+=Math.min(imeInset,Math.max(0,getContentHeight() - (getHeight() - imeInset)));
  return scrollRange;
}
Program: 192248
Project: 192248
Buggy source:
private int getMinHeight(int maxAllowedVisibleChildren){
  int minExpandHeight=mNotificationHeaderHeight;
  int visibleChildren=0;
  boolean firstChild=true;
  int childCount=mChildren.size();
  for (int i=0; i < childCount; i++) {
    if (visibleChildren >= maxAllowedVisibleChildren) {
      break;
    }
    if (!firstChild) {
      minExpandHeight+=mChildPadding;
    }
 else {
      firstChild=false;
    }
    ExpandableNotificationRow child=mChildren.get(i);
    minExpandHeight+=child.getMinHeight();
    visibleChildren++;
  }
  minExpandHeight+=mCollapsedBottompadding;
  return minExpandHeight;
}

Fixed version (ground truth):
private int getMinHeight(int maxAllowedVisibleChildren){
  int minExpandHeight=mNotificationHeaderHeight;
  int visibleChildren=0;
  boolean firstChild=true;
  int childCount=mChildren.size();
  for (int i=0; i < childCount; i++) {
    if (visibleChildren >= maxAllowedVisibleChildren) {
      break;
    }
    if (!firstChild) {
      minExpandHeight+=mChildPadding;
    }
 else {
      firstChild=false;
    }
    ExpandableNotificationRow child=mChildren.get(i);
    minExpandHeight+=child.getSingleLineView().getHeight();
    visibleChildren++;
  }
  minExpandHeight+=mCollapsedBottompadding;
  return minExpandHeight;
}
Program: 192249
Project: 192249
Buggy source:
private void updateSoftKeyboardShowModeLocked(UserState userState){
  final int userId=userState.mUserId;
  if ((userId == mCurrentUserId) && (userState.mSoftKeyboardShowMode != 0)) {
    boolean serviceChangingSoftKeyboardModeIsEnabled=userState.mEnabledServices.contains(userState.mServiceChangingSoftKeyboardMode);
    if (!serviceChangingSoftKeyboardModeIsEnabled) {
      final long identity=Binder.clearCallingIdentity();
      try {
        Settings.Secure.putIntForUser(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE,0,userState.mUserId);
      }
  finally {
        Binder.restoreCallingIdentity(identity);
      }
      userState.mSoftKeyboardShowMode=0;
      userState.mServiceChangingSoftKeyboardMode=null;
    }
    notifySoftKeyboardShowModeChangedLocked(userState.mSoftKeyboardShowMode);
  }
}

Fixed version (ground truth):
private void updateSoftKeyboardShowModeLocked(UserState userState){
  final int userId=userState.mUserId;
  if ((userId == mCurrentUserId) && (userState.mSoftKeyboardShowMode != 0)) {
    boolean serviceChangingSoftKeyboardModeIsEnabled=userState.mEnabledServices.contains(userState.mServiceChangingSoftKeyboardMode);
    if (!serviceChangingSoftKeyboardModeIsEnabled) {
      final long identity=Binder.clearCallingIdentity();
      try {
        Settings.Secure.putIntForUser(mContext.getContentResolver(),Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE,0,userState.mUserId);
      }
  finally {
        Binder.restoreCallingIdentity(identity);
      }
      userState.mSoftKeyboardShowMode=0;
      userState.mServiceChangingSoftKeyboardMode=null;
      notifySoftKeyboardShowModeChangedLocked(userState.mSoftKeyboardShowMode);
    }
  }
}
Program: 192251
Project: 192251
Buggy source:
/** 
 * This is called with the full size of the window since we are handling our own insets.
 */
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  if (mTaskStackView.getVisibility() != GONE) {
    mTaskStackView.layout(left,top,left + getMeasuredWidth(),top + getMeasuredHeight());
  }
  if (mEmptyView.getVisibility() != GONE) {
    int leftRightInsets=mSystemInsets.left + mSystemInsets.right;
    int topBottomInsets=mSystemInsets.top + mSystemInsets.bottom;
    int childWidth=mEmptyView.getMeasuredWidth();
    int childHeight=mEmptyView.getMeasuredHeight();
    int childLeft=left + Math.max(0,(right - left - leftRightInsets- childWidth)) / 2;
    int childTop=top + Math.max(0,(bottom - top - topBottomInsets- childHeight)) / 2;
    mEmptyView.layout(childLeft,childTop,childLeft + childWidth,childTop + childHeight);
  }
  if (RecentsDebugFlags.Static.EnableStackActionButton) {
    Rect buttonBounds=getStackActionButtonBoundsFromStackLayout();
    mStackActionButton.layout(buttonBounds.left,buttonBounds.top,buttonBounds.right,buttonBounds.bottom);
  }
  if (mAwaitingFirstLayout) {
    mAwaitingFirstLayout=false;
    RecentsActivityLaunchState launchState=Recents.getConfiguration().getLaunchState();
    if (launchState.launchedViaDragGesture) {
      setTranslationY(getMeasuredHeight());
    }
 else {
      setTranslationY(0f);
    }
  }
}

Fixed version (ground truth):
/** 
 * This is called with the full size of the window since we are handling our own insets.
 */
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  if (mTaskStackView.getVisibility() != GONE) {
    mTaskStackView.layout(left,top,left + getMeasuredWidth(),top + getMeasuredHeight());
  }
  if (mEmptyView.getVisibility() != GONE) {
    int leftRightInsets=mSystemInsets.left + mSystemInsets.right;
    int topBottomInsets=mSystemInsets.top + mSystemInsets.bottom;
    int childWidth=mEmptyView.getMeasuredWidth();
    int childHeight=mEmptyView.getMeasuredHeight();
    int childLeft=left + mSystemInsets.left + Math.max(0,(right - left - leftRightInsets- childWidth)) / 2;
    int childTop=top + mSystemInsets.top + Math.max(0,(bottom - top - topBottomInsets- childHeight)) / 2;
    mEmptyView.layout(childLeft,childTop,childLeft + childWidth,childTop + childHeight);
  }
  if (RecentsDebugFlags.Static.EnableStackActionButton) {
    Rect buttonBounds=getStackActionButtonBoundsFromStackLayout();
    mStackActionButton.layout(buttonBounds.left,buttonBounds.top,buttonBounds.right,buttonBounds.bottom);
  }
  if (mAwaitingFirstLayout) {
    mAwaitingFirstLayout=false;
    RecentsActivityLaunchState launchState=Recents.getConfiguration().getLaunchState();
    if (launchState.launchedViaDragGesture) {
      setTranslationY(getMeasuredHeight());
    }
 else {
      setTranslationY(0f);
    }
  }
}
Program: 192252
Project: 192252
Buggy source:
/** 
 * @return True if the view is expandable, false otherwise.
 */
private boolean startExpanding(ExpandableView v,int expandType){
  if (!(v instanceof ExpandableNotificationRow)) {
    return false;
  }
  mExpansionStyle=expandType;
  if (mExpanding && v == mResizedView) {
    return true;
  }
  mExpanding=true;
  mCallback.expansionStateChanged(true);
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + expandType + "String_Node_Str"+ v);
  mCallback.setUserLockedChild(v,true);
  mScaler.setView(v);
  mOldHeight=mScaler.getHeight();
  mCurrentHeight=mOldHeight;
  boolean canBeExpanded=mCallback.canChildBeExpanded(v);
  if (canBeExpanded) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mNaturalHeight=mScaler.getNaturalHeight();
    mSmallSize=v.getMinExpandHeight();
  }
 else {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mNaturalHeight=mOldHeight;
  }
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mOldHeight + "String_Node_Str"+ mNaturalHeight);
  return true;
}

Fixed version (ground truth):
/** 
 * @return True if the view is expandable, false otherwise.
 */
private boolean startExpanding(ExpandableView v,int expandType){
  if (!(v instanceof ExpandableNotificationRow)) {
    return false;
  }
  mExpansionStyle=expandType;
  if (mExpanding && v == mResizedView) {
    return true;
  }
  mExpanding=true;
  mCallback.expansionStateChanged(true);
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + expandType + "String_Node_Str"+ v);
  mCallback.setUserLockedChild(v,true);
  mScaler.setView(v);
  mOldHeight=mScaler.getHeight();
  mCurrentHeight=mOldHeight;
  boolean canBeExpanded=mCallback.canChildBeExpanded(v);
  if (canBeExpanded) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mNaturalHeight=mScaler.getNaturalHeight();
    mSmallSize=v.getCollapsedHeight();
  }
 else {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mNaturalHeight=mOldHeight;
  }
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mOldHeight + "String_Node_Str"+ mNaturalHeight);
  return true;
}
Program: 192253
Project: 192253
Buggy source:
private void handleExpansion(float heightDelta,ExpandableView child){
  if (heightDelta < 0) {
    heightDelta=0;
  }
  boolean expandable=child.isContentExpandable();
  float rubberbandFactor=expandable ? RUBBERBAND_FACTOR_EXPANDABLE : RUBBERBAND_FACTOR_STATIC;
  float rubberband=heightDelta * rubberbandFactor;
  if (expandable && (rubberband + child.getMinExpandHeight()) > child.getMaxContentHeight()) {
    float overshoot=(rubberband + child.getMinExpandHeight()) - child.getMaxContentHeight();
    overshoot*=(1 - RUBBERBAND_FACTOR_STATIC);
    rubberband-=overshoot;
  }
  child.setActualHeight((int)(child.getMinExpandHeight() + rubberband));
}

Fixed version (ground truth):
private void handleExpansion(float heightDelta,ExpandableView child){
  if (heightDelta < 0) {
    heightDelta=0;
  }
  boolean expandable=child.isContentExpandable();
  float rubberbandFactor=expandable ? RUBBERBAND_FACTOR_EXPANDABLE : RUBBERBAND_FACTOR_STATIC;
  float rubberband=heightDelta * rubberbandFactor;
  if (expandable && (rubberband + child.getCollapsedHeight()) > child.getMaxContentHeight()) {
    float overshoot=(rubberband + child.getCollapsedHeight()) - child.getMaxContentHeight();
    overshoot*=(1 - RUBBERBAND_FACTOR_STATIC);
    rubberband-=overshoot;
  }
  child.setActualHeight((int)(child.getCollapsedHeight() + rubberband));
}
Program: 192254
Project: 192254
Buggy source:
@Override public int getIntrinsicHeight(){
  if (isUserLocked()) {
    return getActualHeight();
  }
  if (mGuts != null && mGuts.areGutsExposed()) {
    return mGuts.getHeight();
  }
 else   if ((isChildInGroup() && !isGroupExpanded())) {
    return mPrivateLayout.getMinHeight();
  }
 else   if (mSensitive && mHideSensitiveForIntrinsicHeight) {
    return getMinHeight();
  }
 else   if (mIsSummaryWithChildren && !mOnKeyguard) {
    return mChildrenContainer.getIntrinsicHeight();
  }
 else   if (mIsHeadsUp) {
    if (isPinned()) {
      return getPinnedHeadsUpHeight(true);
    }
 else     if (isExpanded()) {
      return Math.max(getMaxExpandHeight(),mHeadsUpHeight);
    }
 else {
      return Math.max(getMinHeight(),mHeadsUpHeight);
    }
  }
 else   if (isExpanded()) {
    return getMaxExpandHeight();
  }
 else {
    return getMinHeight();
  }
}

Fixed version (ground truth):
@Override public int getIntrinsicHeight(){
  if (isUserLocked()) {
    return getActualHeight();
  }
  if (mGuts != null && mGuts.areGutsExposed()) {
    return mGuts.getHeight();
  }
 else   if ((isChildInGroup() && !isGroupExpanded())) {
    return mPrivateLayout.getMinHeight();
  }
 else   if (mSensitive && mHideSensitiveForIntrinsicHeight) {
    return getMinHeight();
  }
 else   if (mIsSummaryWithChildren && !mOnKeyguard) {
    return mChildrenContainer.getIntrinsicHeight();
  }
 else   if (mIsHeadsUp) {
    if (isPinned()) {
      return getPinnedHeadsUpHeight(true);
    }
 else     if (isExpanded()) {
      return Math.max(getMaxExpandHeight(),mHeadsUpHeight);
    }
 else {
      return Math.max(getCollapsedHeight(),mHeadsUpHeight);
    }
  }
 else   if (isExpanded()) {
    return getMaxExpandHeight();
  }
 else {
    return getCollapsedHeight();
  }
}
Program: 192255
Project: 192255
Buggy source:
/** 
 * @param atLeastMinHeight should the value returned be at least the minimum height.Used to avoid cyclic calls
 * @return the height of the heads up notification when pinned
 */
public int getPinnedHeadsUpHeight(boolean atLeastMinHeight){
  if (mIsSummaryWithChildren) {
    return mChildrenContainer.getIntrinsicHeight();
  }
  if (mExpandedWhenPinned) {
    return Math.max(getMaxExpandHeight(),mHeadsUpHeight);
  }
 else   if (atLeastMinHeight) {
    return Math.max(getMinHeight(),mHeadsUpHeight);
  }
 else {
    return mHeadsUpHeight;
  }
}

Fixed version (ground truth):
/** 
 * @param atLeastMinHeight should the value returned be at least the minimum height.Used to avoid cyclic calls
 * @return the height of the heads up notification when pinned
 */
public int getPinnedHeadsUpHeight(boolean atLeastMinHeight){
  if (mIsSummaryWithChildren) {
    return mChildrenContainer.getIntrinsicHeight();
  }
  if (mExpandedWhenPinned) {
    return Math.max(getMaxExpandHeight(),mHeadsUpHeight);
  }
 else   if (atLeastMinHeight) {
    return Math.max(getCollapsedHeight(),mHeadsUpHeight);
  }
 else {
    return mHeadsUpHeight;
  }
}
Program: 192256
Project: 192256
Buggy source:
/** 
 * @return one of the static enum types in this view, calculated form the current state
 */
private int calculateVisibleType(){
  if (mUserExpanding) {
    int height=!mIsChildInGroup || isGroupExpanded() || mContainingNotification.isExpanded(true) ? mContainingNotification.getMaxContentHeight() : mContainingNotification.getShowingLayout().getMinHeight();
    if (height == 0) {
      height=mContentHeight;
    }
    int expandedVisualType=getVisualTypeForHeight(height);
    int collapsedVisualType=getVisualTypeForHeight(mContainingNotification.getMinExpandHeight());
    return mTransformationStartVisibleType == collapsedVisualType ? expandedVisualType : collapsedVisualType;
  }
  int intrinsicHeight=mContainingNotification.getIntrinsicHeight();
  int viewHeight=mContentHeight;
  if (intrinsicHeight != 0) {
    viewHeight=Math.min(mContentHeight,intrinsicHeight);
  }
  return getVisualTypeForHeight(viewHeight);
}

Fixed version (ground truth):
/** 
 * @return one of the static enum types in this view, calculated form the current state
 */
private int calculateVisibleType(){
  if (mUserExpanding) {
    int height=!mIsChildInGroup || isGroupExpanded() || mContainingNotification.isExpanded(true) ? mContainingNotification.getMaxContentHeight() : mContainingNotification.getShowingLayout().getMinHeight();
    if (height == 0) {
      height=mContentHeight;
    }
    int expandedVisualType=getVisualTypeForHeight(height);
    int collapsedVisualType=getVisualTypeForHeight(mContainingNotification.getCollapsedHeight());
    return mTransformationStartVisibleType == collapsedVisualType ? expandedVisualType : collapsedVisualType;
  }
  int intrinsicHeight=mContainingNotification.getIntrinsicHeight();
  int viewHeight=mContentHeight;
  if (intrinsicHeight != 0) {
    viewHeight=Math.min(mContentHeight,intrinsicHeight);
  }
  return getVisualTypeForHeight(viewHeight);
}
Program: 192257
Project: 192257
Buggy source:
public float getGroupExpandFraction(){
  int visibleChildrenExpandedHeight=getVisibleChildrenExpandHeight();
  int minExpandHeight=getMinExpandHeight();
  float factor=(mActualHeight - minExpandHeight) / (float)(visibleChildrenExpandedHeight - minExpandHeight);
  return Math.max(0.0f,Math.min(1.0f,factor));
}

Fixed version (ground truth):
public float getGroupExpandFraction(){
  int visibleChildrenExpandedHeight=getVisibleChildrenExpandHeight();
  int minExpandHeight=getCollapsedHeight();
  float factor=(mActualHeight - minExpandHeight) / (float)(visibleChildrenExpandedHeight - minExpandHeight);
  return Math.max(0.0f,Math.min(1.0f,factor));
}
Program: 192258
Project: 192258
Buggy source:
public int getMinHeight(){
  return getIntrinsicHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED);
}

Fixed version (ground truth):
private int getMinHeight(int maxAllowedVisibleChildren){
  int minExpandHeight=mNotificationHeaderHeight;
  int visibleChildren=0;
  boolean firstChild=true;
  int childCount=mChildren.size();
  for (int i=0; i < childCount; i++) {
    if (visibleChildren >= maxAllowedVisibleChildren) {
      break;
    }
    if (!firstChild) {
      minExpandHeight+=mChildPadding;
    }
 else {
      firstChild=false;
    }
    ExpandableNotificationRow child=mChildren.get(i);
    minExpandHeight+=child.getMinHeight();
    visibleChildren++;
  }
  minExpandHeight+=mCollapsedBottompadding;
  return minExpandHeight;
}
Program: 192259
Project: 192259
Buggy source:
public int getPeekHeight(){
  final ExpandableView firstChild=getFirstChildNotGone();
  final int firstChildMinHeight=firstChild != null ? (int)firstChild.getMinHeight() : mCollapsedSize;
  return mIntrinsicPadding + firstChildMinHeight + mBottomStackPeekSize+ mBottomStackSlowDownHeight;
}

Fixed version (ground truth):
public int getPeekHeight(){
  final ExpandableView firstChild=getFirstChildNotGone();
  final int firstChildMinHeight=firstChild != null ? firstChild.getCollapsedHeight() : mCollapsedSize;
  return mIntrinsicPadding + firstChildMinHeight + mBottomStackPeekSize+ mBottomStackSlowDownHeight;
}
Program: 192260
Project: 192260
Buggy source:
/** 
 * Update the height of the first child i.e clamp it to the bottom stack
 * @param child the child to update
 * @param childViewState the viewstate of the child
 * @param childHeight the height of the child
 * @param ambientState The ambient state of the algorithm
 */
private void updateFirstChildHeight(ExpandableView child,StackViewState childViewState,int childHeight,AmbientState ambientState){
  int bottomPeekStart=ambientState.getInnerHeight() - mBottomStackPeekSize - mBottomStackSlowDownLength + ambientState.getScrollY();
  childViewState.height=(int)Math.max(Math.min(bottomPeekStart,(float)childHeight),child.getMinHeight());
}

Fixed version (ground truth):
/** 
 * Update the height of the first child i.e clamp it to the bottom stack
 * @param child the child to update
 * @param childViewState the viewstate of the child
 * @param childHeight the height of the child
 * @param ambientState The ambient state of the algorithm
 */
private void updateFirstChildHeight(ExpandableView child,StackViewState childViewState,int childHeight,AmbientState ambientState){
  int bottomPeekStart=ambientState.getInnerHeight() - mBottomStackPeekSize - mBottomStackSlowDownLength + ambientState.getScrollY();
  childViewState.height=(int)Math.max(Math.min(bottomPeekStart,(float)childHeight),child.getCollapsedHeight());
}
Program: 192262
Project: 192262
Buggy source:
private void updateStateForChildTransitioningInBottom(StackScrollAlgorithmState algorithmState,float transitioningPositionStart,ExpandableView child,float currentYPosition,StackViewState childViewState,int childHeight){
  algorithmState.partialInBottom=1.0f - ((transitioningPositionStart - currentYPosition) / (childHeight + getPaddingAfterChild(algorithmState,child)));
  float offset=mBottomStackIndentationFunctor.getValue(algorithmState.partialInBottom);
  algorithmState.itemsInBottomStack+=algorithmState.partialInBottom;
  int newHeight=childHeight;
  if (childHeight > child.getMinHeight()) {
    newHeight=(int)Math.max(Math.min(transitioningPositionStart + offset - getPaddingAfterChild(algorithmState,child) - currentYPosition,childHeight),child.getMinHeight());
    childViewState.height=newHeight;
  }
  childViewState.yTranslation=transitioningPositionStart + offset - newHeight - getPaddingAfterChild(algorithmState,child);
  childViewState.location=StackViewState.LOCATION_MAIN_AREA;
}

Fixed version (ground truth):
private void updateStateForChildTransitioningInBottom(StackScrollAlgorithmState algorithmState,float transitioningPositionStart,ExpandableView child,float currentYPosition,StackViewState childViewState,int childHeight){
  algorithmState.partialInBottom=1.0f - ((transitioningPositionStart - currentYPosition) / (childHeight + getPaddingAfterChild(algorithmState,child)));
  float offset=mBottomStackIndentationFunctor.getValue(algorithmState.partialInBottom);
  algorithmState.itemsInBottomStack+=algorithmState.partialInBottom;
  int newHeight=childHeight;
  if (childHeight > child.getCollapsedHeight()) {
    newHeight=(int)Math.max(Math.min(transitioningPositionStart + offset - getPaddingAfterChild(algorithmState,child) - currentYPosition,childHeight),child.getCollapsedHeight());
    childViewState.height=newHeight;
  }
  childViewState.yTranslation=transitioningPositionStart + offset - newHeight - getPaddingAfterChild(algorithmState,child);
  childViewState.location=StackViewState.LOCATION_MAIN_AREA;
}
Program: 192263
Project: 192263
Buggy source:
private void clampHunToTop(AmbientState ambientState,ExpandableNotificationRow row,StackViewState childState){
  float newTranslation=Math.max(ambientState.getTopPadding() + ambientState.getStackTranslation(),childState.yTranslation);
  childState.height=(int)Math.max(childState.height - (newTranslation - childState.yTranslation),row.getMinHeight());
  childState.yTranslation=newTranslation;
}

Fixed version (ground truth):
private void clampHunToTop(AmbientState ambientState,ExpandableNotificationRow row,StackViewState childState){
  float newTranslation=Math.max(ambientState.getTopPadding() + ambientState.getStackTranslation(),childState.yTranslation);
  childState.height=(int)Math.max(childState.height - (newTranslation - childState.yTranslation),row.getCollapsedHeight());
  childState.yTranslation=newTranslation;
}
Program: 192264
Project: 192264
Buggy source:
private void clampHunToMaxTranslation(AmbientState ambientState,ExpandableNotificationRow row,StackViewState childState){
  float newTranslation;
  float bottomPosition=ambientState.getMaxHeadsUpTranslation() - row.getMinHeight();
  newTranslation=Math.min(childState.yTranslation,bottomPosition);
  childState.height=(int)Math.max(childState.height - (childState.yTranslation - newTranslation),row.getMinHeight());
  childState.yTranslation=newTranslation;
}

Fixed version (ground truth):
private void clampHunToMaxTranslation(AmbientState ambientState,ExpandableNotificationRow row,StackViewState childState){
  float newTranslation;
  float bottomPosition=ambientState.getMaxHeadsUpTranslation() - row.getCollapsedHeight();
  newTranslation=Math.min(childState.yTranslation,bottomPosition);
  childState.height=(int)Math.max(childState.height - (childState.yTranslation - newTranslation),row.getCollapsedHeight());
  childState.yTranslation=newTranslation;
}
Program: 192265
Project: 192265
Buggy source:
private void updateStateForChildFullyInBottomStack(StackScrollAlgorithmState algorithmState,float transitioningPositionStart,StackViewState childViewState,int minHeight,AmbientState ambientState,ExpandableView child){
  float currentYPosition;
  algorithmState.itemsInBottomStack+=1.0f;
  if (algorithmState.itemsInBottomStack < MAX_ITEMS_IN_BOTTOM_STACK) {
    currentYPosition=transitioningPositionStart + mBottomStackIndentationFunctor.getValue(algorithmState.itemsInBottomStack) - getPaddingAfterChild(algorithmState,child);
    childViewState.location=StackViewState.LOCATION_BOTTOM_STACK_PEEKING;
  }
 else {
    if (algorithmState.itemsInBottomStack > MAX_ITEMS_IN_BOTTOM_STACK + 2) {
      childViewState.hidden=true;
      childViewState.shadowAlpha=0.0f;
    }
 else     if (algorithmState.itemsInBottomStack > MAX_ITEMS_IN_BOTTOM_STACK + 1) {
      childViewState.shadowAlpha=1.0f - algorithmState.partialInBottom;
    }
    childViewState.location=StackViewState.LOCATION_BOTTOM_STACK_HIDDEN;
    currentYPosition=ambientState.getInnerHeight();
  }
  childViewState.height=minHeight;
  childViewState.yTranslation=currentYPosition - minHeight;
}

Fixed version (ground truth):
private void updateStateForChildFullyInBottomStack(StackScrollAlgorithmState algorithmState,float transitioningPositionStart,StackViewState childViewState,int collapsedHeight,AmbientState ambientState,ExpandableView child){
  float currentYPosition;
  algorithmState.itemsInBottomStack+=1.0f;
  if (algorithmState.itemsInBottomStack < MAX_ITEMS_IN_BOTTOM_STACK) {
    currentYPosition=transitioningPositionStart + mBottomStackIndentationFunctor.getValue(algorithmState.itemsInBottomStack) - getPaddingAfterChild(algorithmState,child);
    childViewState.location=StackViewState.LOCATION_BOTTOM_STACK_PEEKING;
  }
 else {
    if (algorithmState.itemsInBottomStack > MAX_ITEMS_IN_BOTTOM_STACK + 2) {
      childViewState.hidden=true;
      childViewState.shadowAlpha=0.0f;
    }
 else     if (algorithmState.itemsInBottomStack > MAX_ITEMS_IN_BOTTOM_STACK + 1) {
      childViewState.shadowAlpha=1.0f - algorithmState.partialInBottom;
    }
    childViewState.location=StackViewState.LOCATION_BOTTOM_STACK_HIDDEN;
    currentYPosition=ambientState.getInnerHeight();
  }
  childViewState.height=collapsedHeight;
  childViewState.yTranslation=currentYPosition - collapsedHeight;
}
Program: 192266
Project: 192266
Buggy source:
/** 
 * @return True if the view is expandable, false otherwise.
 */
private boolean startExpanding(ExpandableView v,int expandType){
  if (!(v instanceof ExpandableNotificationRow)) {
    return false;
  }
  mExpansionStyle=expandType;
  if (mExpanding && v == mResizedView) {
    return true;
  }
  mExpanding=true;
  mCallback.expansionStateChanged(true);
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + expandType + "String_Node_Str"+ v);
  mCallback.setUserLockedChild(v,true);
  mScaler.setView(v);
  mOldHeight=mScaler.getHeight();
  mCurrentHeight=mOldHeight;
  boolean canBeExpanded=mCallback.canChildBeExpanded(v);
  if (canBeExpanded) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mNaturalHeight=mScaler.getNaturalHeight();
    mSmallSize=v.getMinExpandHeight();
  }
 else {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mNaturalHeight=mOldHeight;
  }
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mOldHeight + "String_Node_Str"+ mNaturalHeight);
  return true;
}

Fixed version (ground truth):
/** 
 * @return True if the view is expandable, false otherwise.
 */
private boolean startExpanding(ExpandableView v,int expandType){
  if (!(v instanceof ExpandableNotificationRow)) {
    return false;
  }
  mExpansionStyle=expandType;
  if (mExpanding && v == mResizedView) {
    return true;
  }
  mExpanding=true;
  mCallback.expansionStateChanged(true);
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + expandType + "String_Node_Str"+ v);
  mCallback.setUserLockedChild(v,true);
  mScaler.setView(v);
  mOldHeight=mScaler.getHeight();
  mCurrentHeight=mOldHeight;
  boolean canBeExpanded=mCallback.canChildBeExpanded(v);
  if (canBeExpanded) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mNaturalHeight=mScaler.getNaturalHeight();
    mSmallSize=v.getCollapsedHeight();
  }
 else {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mNaturalHeight=mOldHeight;
  }
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mOldHeight + "String_Node_Str"+ mNaturalHeight);
  return true;
}
Program: 192267
Project: 192267
Buggy source:
private void handleExpansion(float heightDelta,ExpandableView child){
  if (heightDelta < 0) {
    heightDelta=0;
  }
  boolean expandable=child.isContentExpandable();
  float rubberbandFactor=expandable ? RUBBERBAND_FACTOR_EXPANDABLE : RUBBERBAND_FACTOR_STATIC;
  float rubberband=heightDelta * rubberbandFactor;
  if (expandable && (rubberband + child.getMinExpandHeight()) > child.getMaxContentHeight()) {
    float overshoot=(rubberband + child.getMinExpandHeight()) - child.getMaxContentHeight();
    overshoot*=(1 - RUBBERBAND_FACTOR_STATIC);
    rubberband-=overshoot;
  }
  child.setActualHeight((int)(child.getMinExpandHeight() + rubberband));
}

Fixed version (ground truth):
private void handleExpansion(float heightDelta,ExpandableView child){
  if (heightDelta < 0) {
    heightDelta=0;
  }
  boolean expandable=child.isContentExpandable();
  float rubberbandFactor=expandable ? RUBBERBAND_FACTOR_EXPANDABLE : RUBBERBAND_FACTOR_STATIC;
  float rubberband=heightDelta * rubberbandFactor;
  if (expandable && (rubberband + child.getCollapsedHeight()) > child.getMaxContentHeight()) {
    float overshoot=(rubberband + child.getCollapsedHeight()) - child.getMaxContentHeight();
    overshoot*=(1 - RUBBERBAND_FACTOR_STATIC);
    rubberband-=overshoot;
  }
  child.setActualHeight((int)(child.getCollapsedHeight() + rubberband));
}
Program: 192268
Project: 192268
Buggy source:
@Override public int getIntrinsicHeight(){
  if (isUserLocked()) {
    return getActualHeight();
  }
  if (mGuts != null && mGuts.areGutsExposed()) {
    return mGuts.getHeight();
  }
 else   if ((isChildInGroup() && !isGroupExpanded())) {
    return mPrivateLayout.getMinHeight();
  }
 else   if (mSensitive && mHideSensitiveForIntrinsicHeight) {
    return getMinHeight();
  }
 else   if (mIsSummaryWithChildren && !mOnKeyguard) {
    return mChildrenContainer.getIntrinsicHeight();
  }
 else   if (mIsHeadsUp) {
    if (isPinned()) {
      return getPinnedHeadsUpHeight(true);
    }
 else     if (isExpanded()) {
      return Math.max(getMaxExpandHeight(),mHeadsUpHeight);
    }
 else {
      return Math.max(getMinHeight(),mHeadsUpHeight);
    }
  }
 else   if (isExpanded()) {
    return getMaxExpandHeight();
  }
 else {
    return getMinHeight();
  }
}

Fixed version (ground truth):
@Override public int getIntrinsicHeight(){
  if (isUserLocked()) {
    return getActualHeight();
  }
  if (mGuts != null && mGuts.areGutsExposed()) {
    return mGuts.getHeight();
  }
 else   if ((isChildInGroup() && !isGroupExpanded())) {
    return mPrivateLayout.getMinHeight();
  }
 else   if (mSensitive && mHideSensitiveForIntrinsicHeight) {
    return getMinHeight();
  }
 else   if (mIsSummaryWithChildren && !mOnKeyguard) {
    return mChildrenContainer.getIntrinsicHeight();
  }
 else   if (mIsHeadsUp) {
    if (isPinned()) {
      return getPinnedHeadsUpHeight(true);
    }
 else     if (isExpanded()) {
      return Math.max(getMaxExpandHeight(),mHeadsUpHeight);
    }
 else {
      return Math.max(getCollapsedHeight(),mHeadsUpHeight);
    }
  }
 else   if (isExpanded()) {
    return getMaxExpandHeight();
  }
 else {
    return getCollapsedHeight();
  }
}
Program: 192269
Project: 192269
Buggy source:
/** 
 * @param atLeastMinHeight should the value returned be at least the minimum height.Used to avoid cyclic calls
 * @return the height of the heads up notification when pinned
 */
public int getPinnedHeadsUpHeight(boolean atLeastMinHeight){
  if (mIsSummaryWithChildren) {
    return mChildrenContainer.getIntrinsicHeight();
  }
  if (mExpandedWhenPinned) {
    return Math.max(getMaxExpandHeight(),mHeadsUpHeight);
  }
 else   if (atLeastMinHeight) {
    return Math.max(getMinHeight(),mHeadsUpHeight);
  }
 else {
    return mHeadsUpHeight;
  }
}

Fixed version (ground truth):
/** 
 * @param atLeastMinHeight should the value returned be at least the minimum height.Used to avoid cyclic calls
 * @return the height of the heads up notification when pinned
 */
public int getPinnedHeadsUpHeight(boolean atLeastMinHeight){
  if (mIsSummaryWithChildren) {
    return mChildrenContainer.getIntrinsicHeight();
  }
  if (mExpandedWhenPinned) {
    return Math.max(getMaxExpandHeight(),mHeadsUpHeight);
  }
 else   if (atLeastMinHeight) {
    return Math.max(getCollapsedHeight(),mHeadsUpHeight);
  }
 else {
    return mHeadsUpHeight;
  }
}
Program: 192270
Project: 192270
Buggy source:
/** 
 * @return one of the static enum types in this view, calculated form the current state
 */
private int calculateVisibleType(){
  if (mUserExpanding) {
    int height=!mIsChildInGroup || isGroupExpanded() || mContainingNotification.isExpanded(true) ? mContainingNotification.getMaxContentHeight() : mContainingNotification.getShowingLayout().getMinHeight();
    if (height == 0) {
      height=mContentHeight;
    }
    int expandedVisualType=getVisualTypeForHeight(height);
    int collapsedVisualType=getVisualTypeForHeight(mContainingNotification.getMinExpandHeight());
    return mTransformationStartVisibleType == collapsedVisualType ? expandedVisualType : collapsedVisualType;
  }
  int intrinsicHeight=mContainingNotification.getIntrinsicHeight();
  int viewHeight=mContentHeight;
  if (intrinsicHeight != 0) {
    viewHeight=Math.min(mContentHeight,intrinsicHeight);
  }
  return getVisualTypeForHeight(viewHeight);
}

Fixed version (ground truth):
/** 
 * @return one of the static enum types in this view, calculated form the current state
 */
private int calculateVisibleType(){
  if (mUserExpanding) {
    int height=!mIsChildInGroup || isGroupExpanded() || mContainingNotification.isExpanded(true) ? mContainingNotification.getMaxContentHeight() : mContainingNotification.getShowingLayout().getMinHeight();
    if (height == 0) {
      height=mContentHeight;
    }
    int expandedVisualType=getVisualTypeForHeight(height);
    int collapsedVisualType=getVisualTypeForHeight(mContainingNotification.getCollapsedHeight());
    return mTransformationStartVisibleType == collapsedVisualType ? expandedVisualType : collapsedVisualType;
  }
  int intrinsicHeight=mContainingNotification.getIntrinsicHeight();
  int viewHeight=mContentHeight;
  if (intrinsicHeight != 0) {
    viewHeight=Math.min(mContentHeight,intrinsicHeight);
  }
  return getVisualTypeForHeight(viewHeight);
}
Program: 192271
Project: 192271
Buggy source:
public float getGroupExpandFraction(){
  int visibleChildrenExpandedHeight=getVisibleChildrenExpandHeight();
  int minExpandHeight=getMinExpandHeight();
  float factor=(mActualHeight - minExpandHeight) / (float)(visibleChildrenExpandedHeight - minExpandHeight);
  return Math.max(0.0f,Math.min(1.0f,factor));
}

Fixed version (ground truth):
public float getGroupExpandFraction(){
  int visibleChildrenExpandedHeight=getVisibleChildrenExpandHeight();
  int minExpandHeight=getCollapsedHeight();
  float factor=(mActualHeight - minExpandHeight) / (float)(visibleChildrenExpandedHeight - minExpandHeight);
  return Math.max(0.0f,Math.min(1.0f,factor));
}
Program: 192272
Project: 192272
Buggy source:
public int getMinHeight(){
  return getIntrinsicHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED);
}

Fixed version (ground truth):
private int getMinHeight(int maxAllowedVisibleChildren){
  int minExpandHeight=mNotificationHeaderHeight;
  int visibleChildren=0;
  boolean firstChild=true;
  int childCount=mChildren.size();
  for (int i=0; i < childCount; i++) {
    if (visibleChildren >= maxAllowedVisibleChildren) {
      break;
    }
    if (!firstChild) {
      minExpandHeight+=mChildPadding;
    }
 else {
      firstChild=false;
    }
    ExpandableNotificationRow child=mChildren.get(i);
    minExpandHeight+=child.getMinHeight();
    visibleChildren++;
  }
  minExpandHeight+=mCollapsedBottompadding;
  return minExpandHeight;
}
Program: 192273
Project: 192273
Buggy source:
public int getPeekHeight(){
  final ExpandableView firstChild=getFirstChildNotGone();
  final int firstChildMinHeight=firstChild != null ? (int)firstChild.getMinHeight() : mCollapsedSize;
  return mIntrinsicPadding + firstChildMinHeight + mBottomStackPeekSize+ mBottomStackSlowDownHeight;
}

Fixed version (ground truth):
public int getPeekHeight(){
  final ExpandableView firstChild=getFirstChildNotGone();
  final int firstChildMinHeight=firstChild != null ? firstChild.getCollapsedHeight() : mCollapsedSize;
  return mIntrinsicPadding + firstChildMinHeight + mBottomStackPeekSize+ mBottomStackSlowDownHeight;
}
Program: 192274
Project: 192274
Buggy source:
/** 
 * Update the height of the first child i.e clamp it to the bottom stack
 * @param child the child to update
 * @param childViewState the viewstate of the child
 * @param childHeight the height of the child
 * @param ambientState The ambient state of the algorithm
 */
private void updateFirstChildHeight(ExpandableView child,StackViewState childViewState,int childHeight,AmbientState ambientState){
  int bottomPeekStart=ambientState.getInnerHeight() - mBottomStackPeekSize - mBottomStackSlowDownLength + ambientState.getScrollY();
  childViewState.height=(int)Math.max(Math.min(bottomPeekStart,(float)childHeight),child.getMinHeight());
}

Fixed version (ground truth):
/** 
 * Update the height of the first child i.e clamp it to the bottom stack
 * @param child the child to update
 * @param childViewState the viewstate of the child
 * @param childHeight the height of the child
 * @param ambientState The ambient state of the algorithm
 */
private void updateFirstChildHeight(ExpandableView child,StackViewState childViewState,int childHeight,AmbientState ambientState){
  int bottomPeekStart=ambientState.getInnerHeight() - mBottomStackPeekSize - mBottomStackSlowDownLength + ambientState.getScrollY();
  childViewState.height=(int)Math.max(Math.min(bottomPeekStart,(float)childHeight),child.getCollapsedHeight());
}
Program: 192276
Project: 192276
Buggy source:
private void updateStateForChildTransitioningInBottom(StackScrollAlgorithmState algorithmState,float transitioningPositionStart,ExpandableView child,float currentYPosition,StackViewState childViewState,int childHeight){
  algorithmState.partialInBottom=1.0f - ((transitioningPositionStart - currentYPosition) / (childHeight + getPaddingAfterChild(algorithmState,child)));
  float offset=mBottomStackIndentationFunctor.getValue(algorithmState.partialInBottom);
  algorithmState.itemsInBottomStack+=algorithmState.partialInBottom;
  int newHeight=childHeight;
  if (childHeight > child.getMinHeight()) {
    newHeight=(int)Math.max(Math.min(transitioningPositionStart + offset - getPaddingAfterChild(algorithmState,child) - currentYPosition,childHeight),child.getMinHeight());
    childViewState.height=newHeight;
  }
  childViewState.yTranslation=transitioningPositionStart + offset - newHeight - getPaddingAfterChild(algorithmState,child);
  childViewState.location=StackViewState.LOCATION_MAIN_AREA;
}

Fixed version (ground truth):
private void updateStateForChildTransitioningInBottom(StackScrollAlgorithmState algorithmState,float transitioningPositionStart,ExpandableView child,float currentYPosition,StackViewState childViewState,int childHeight){
  algorithmState.partialInBottom=1.0f - ((transitioningPositionStart - currentYPosition) / (childHeight + getPaddingAfterChild(algorithmState,child)));
  float offset=mBottomStackIndentationFunctor.getValue(algorithmState.partialInBottom);
  algorithmState.itemsInBottomStack+=algorithmState.partialInBottom;
  int newHeight=childHeight;
  if (childHeight > child.getCollapsedHeight()) {
    newHeight=(int)Math.max(Math.min(transitioningPositionStart + offset - getPaddingAfterChild(algorithmState,child) - currentYPosition,childHeight),child.getCollapsedHeight());
    childViewState.height=newHeight;
  }
  childViewState.yTranslation=transitioningPositionStart + offset - newHeight - getPaddingAfterChild(algorithmState,child);
  childViewState.location=StackViewState.LOCATION_MAIN_AREA;
}
Program: 192277
Project: 192277
Buggy source:
private void clampHunToTop(AmbientState ambientState,ExpandableNotificationRow row,StackViewState childState){
  float newTranslation=Math.max(ambientState.getTopPadding() + ambientState.getStackTranslation(),childState.yTranslation);
  childState.height=(int)Math.max(childState.height - (newTranslation - childState.yTranslation),row.getMinHeight());
  childState.yTranslation=newTranslation;
}

Fixed version (ground truth):
private void clampHunToTop(AmbientState ambientState,ExpandableNotificationRow row,StackViewState childState){
  float newTranslation=Math.max(ambientState.getTopPadding() + ambientState.getStackTranslation(),childState.yTranslation);
  childState.height=(int)Math.max(childState.height - (newTranslation - childState.yTranslation),row.getCollapsedHeight());
  childState.yTranslation=newTranslation;
}
Program: 192278
Project: 192278
Buggy source:
private void clampHunToMaxTranslation(AmbientState ambientState,ExpandableNotificationRow row,StackViewState childState){
  float newTranslation;
  float bottomPosition=ambientState.getMaxHeadsUpTranslation() - row.getMinHeight();
  newTranslation=Math.min(childState.yTranslation,bottomPosition);
  childState.height=(int)Math.max(childState.height - (childState.yTranslation - newTranslation),row.getMinHeight());
  childState.yTranslation=newTranslation;
}

Fixed version (ground truth):
private void clampHunToMaxTranslation(AmbientState ambientState,ExpandableNotificationRow row,StackViewState childState){
  float newTranslation;
  float bottomPosition=ambientState.getMaxHeadsUpTranslation() - row.getCollapsedHeight();
  newTranslation=Math.min(childState.yTranslation,bottomPosition);
  childState.height=(int)Math.max(childState.height - (childState.yTranslation - newTranslation),row.getCollapsedHeight());
  childState.yTranslation=newTranslation;
}