nus-yam/ex-repair huggingface dataset:
Program: 190931
Project: 190931
Buggy source:
/** 
 * Perform a scroll downward and adapt the overscroll amounts accordingly
 * @param deltaY The amount to scroll downwards, has to be negative.
 * @return The amount of scrolling to be performed by the scroller,not handled by the overScroll amount.
 */
private float overScrollDown(int deltaY){
  deltaY=Math.min(deltaY,0);
  float currentBottomAmount=getCurrentOverScrollAmount(false);
  float newBottomAmount=currentBottomAmount + deltaY;
  if (currentBottomAmount > 0) {
    setOverScrollAmount(newBottomAmount,false,false);
  }
  float scrollAmount=newBottomAmount < 0 ? newBottomAmount : 0.0f;
  float newScrollY=mOwnScrollY + scrollAmount;
  if (newScrollY < 0) {
    float currentTopPixels=getCurrentOverScrolledPixels(true);
    setOverScrolledPixels(currentTopPixels - newScrollY,true,false);
    mOwnScrollY=0;
    scrollAmount=0.0f;
  }
  return scrollAmount;
}

Fixed version (ground truth):
/** 
 * Perform a scroll downward and adapt the overscroll amounts accordingly
 * @param deltaY The amount to scroll downwards, has to be negative.
 * @return The amount of scrolling to be performed by the scroller,not handled by the overScroll amount.
 */
private float overScrollDown(int deltaY){
  deltaY=Math.min(deltaY,0);
  float currentBottomAmount=getCurrentOverScrollAmount(false);
  float newBottomAmount=currentBottomAmount + deltaY;
  if (currentBottomAmount > 0) {
    setOverScrollAmount(newBottomAmount,false,false);
  }
  float scrollAmount=newBottomAmount < 0 ? newBottomAmount : 0.0f;
  float newScrollY=mOwnScrollY + scrollAmount;
  if (newScrollY < 0) {
    float currentTopPixels=getCurrentOverScrolledPixels(true);
    setOverScrolledPixels(currentTopPixels - newScrollY,true,false);
    setOwnScrollY(0);
    scrollAmount=0.0f;
  }
  return scrollAmount;
}
Program: 190932
Project: 190932
Buggy source:
private void updateScrollStateForAddedChildren(){
  if (mChildrenToAddAnimated.isEmpty()) {
    return;
  }
  for (int i=0; i < getChildCount(); i++) {
    ExpandableView child=(ExpandableView)getChildAt(i);
    if (mChildrenToAddAnimated.contains(child)) {
      int startingPosition=getPositionInLinearLayout(child);
      int padding=child.getIncreasedPaddingAmount() == 1.0f ? mIncreasedPaddingBetweenElements : mPaddingBetweenElements;
      int childHeight=getIntrinsicHeight(child) + padding;
      if (startingPosition < mOwnScrollY) {
        mOwnScrollY+=childHeight;
      }
    }
  }
  clampScrollPosition();
}

Fixed version (ground truth):
private void updateScrollStateForAddedChildren(){
  if (mChildrenToAddAnimated.isEmpty()) {
    return;
  }
  for (int i=0; i < getChildCount(); i++) {
    ExpandableView child=(ExpandableView)getChildAt(i);
    if (mChildrenToAddAnimated.contains(child)) {
      int startingPosition=getPositionInLinearLayout(child);
      int padding=child.getIncreasedPaddingAmount() == 1.0f ? mIncreasedPaddingBetweenElements : mPaddingBetweenElements;
      int childHeight=getIntrinsicHeight(child) + padding;
      if (startingPosition < mOwnScrollY) {
        setOwnScrollY(mOwnScrollY + childHeight);
      }
    }
  }
  clampScrollPosition();
}
Program: 190933
Project: 190933
Buggy source:
/** 
 * Updates the scroll position when a child was removed
 * @param removedChild the removed child
 */
private void updateScrollStateForRemovedChild(ExpandableView removedChild){
  int startingPosition=getPositionInLinearLayout(removedChild);
  int padding=(int)NotificationUtils.interpolate(mPaddingBetweenElements,mIncreasedPaddingBetweenElements,removedChild.getIncreasedPaddingAmount());
  int childHeight=getIntrinsicHeight(removedChild) + padding;
  int endPosition=startingPosition + childHeight;
  if (endPosition <= mOwnScrollY) {
    mOwnScrollY-=childHeight;
  }
 else   if (startingPosition < mOwnScrollY) {
    mOwnScrollY=startingPosition;
  }
}

Fixed version (ground truth):
/** 
 * Updates the scroll position when a child was removed
 * @param removedChild the removed child
 */
private void updateScrollStateForRemovedChild(ExpandableView removedChild){
  int startingPosition=getPositionInLinearLayout(removedChild);
  int padding=(int)NotificationUtils.interpolate(mPaddingBetweenElements,mIncreasedPaddingBetweenElements,removedChild.getIncreasedPaddingAmount());
  int childHeight=getIntrinsicHeight(removedChild) + padding;
  int endPosition=startingPosition + childHeight;
  if (endPosition <= mOwnScrollY) {
    setOwnScrollY(mOwnScrollY - childHeight);
  }
 else   if (startingPosition < mOwnScrollY) {
    setOwnScrollY(startingPosition);
  }
}
Program: 190934
Project: 190934
Buggy source:
/** 
 * Fling the scroll view
 * @param velocityY The initial velocity in the Y direction. Positivenumbers mean that the finger/cursor is moving down the screen, which means we want to scroll towards the top.
 */
private void fling(int velocityY){
  if (getChildCount() > 0) {
    int scrollRange=getScrollRange();
    float topAmount=getCurrentOverScrollAmount(true);
    float bottomAmount=getCurrentOverScrollAmount(false);
    if (velocityY < 0 && topAmount > 0) {
      mOwnScrollY-=(int)topAmount;
      mDontReportNextOverScroll=true;
      setOverScrollAmount(0,true,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(true) * mOverflingDistance + topAmount;
    }
 else     if (velocityY > 0 && bottomAmount > 0) {
      mOwnScrollY+=bottomAmount;
      setOverScrollAmount(0,false,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(false) * mOverflingDistance + bottomAmount;
    }
 else {
      mMaxOverScroll=0.0f;
    }
    int minScrollY=Math.max(0,scrollRange);
    if (mExpandedInThisMotion) {
      minScrollY=Math.min(minScrollY,mMaxScrollAfterExpand);
    }
    mScroller.fling(mScrollX,mOwnScrollY,1,velocityY,0,0,0,minScrollY,0,mExpandedInThisMotion && mOwnScrollY >= 0 ? 0 : Integer.MAX_VALUE / 2);
    postInvalidateOnAnimation();
  }
}

Fixed version (ground truth):
/** 
 * Fling the scroll view
 * @param velocityY The initial velocity in the Y direction. Positivenumbers mean that the finger/cursor is moving down the screen, which means we want to scroll towards the top.
 */
private void fling(int velocityY){
  if (getChildCount() > 0) {
    int scrollRange=getScrollRange();
    float topAmount=getCurrentOverScrollAmount(true);
    float bottomAmount=getCurrentOverScrollAmount(false);
    if (velocityY < 0 && topAmount > 0) {
      setOwnScrollY(mOwnScrollY - (int)topAmount);
      mDontReportNextOverScroll=true;
      setOverScrollAmount(0,true,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(true) * mOverflingDistance + topAmount;
    }
 else     if (velocityY > 0 && bottomAmount > 0) {
      setOwnScrollY((int)(mOwnScrollY + bottomAmount));
      setOverScrollAmount(0,false,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(false) * mOverflingDistance + bottomAmount;
    }
 else {
      mMaxOverScroll=0.0f;
    }
    int minScrollY=Math.max(0,scrollRange);
    if (mExpandedInThisMotion) {
      minScrollY=Math.min(minScrollY,mMaxScrollAfterExpand);
    }
    mScroller.fling(mScrollX,mOwnScrollY,1,velocityY,0,0,0,minScrollY,0,mExpandedInThisMotion && mOwnScrollY >= 0 ? 0 : Integer.MAX_VALUE / 2);
    postInvalidateOnAnimation();
  }
}
Program: 190935
Project: 190935
Buggy source:
public void onExpansionStopped(){
  mIsExpansionChanging=false;
  if (!mIsExpanded) {
    mOwnScrollY=0;
    mPhoneStatusBar.resetUserExpandedStates();
    clearTemporaryViews(this);
    for (int i=0; i < getChildCount(); i++) {
      ExpandableView child=(ExpandableView)getChildAt(i);
      if (child instanceof ExpandableNotificationRow) {
        ExpandableNotificationRow row=(ExpandableNotificationRow)child;
        clearTemporaryViews(row.getChildrenContainer());
      }
    }
  }
}

Fixed version (ground truth):
public void onExpansionStopped(){
  mIsExpansionChanging=false;
  if (!mIsExpanded) {
    setOwnScrollY(0);
    mPhoneStatusBar.resetUserExpandedStates();
    clearTemporaryViews(this);
    for (int i=0; i < getChildCount(); i++) {
      ExpandableView child=(ExpandableView)getChildAt(i);
      if (child instanceof ExpandableNotificationRow) {
        ExpandableNotificationRow row=(ExpandableNotificationRow)child;
        clearTemporaryViews(row.getChildrenContainer());
      }
    }
  }
}
Program: 190936
Project: 190936
Buggy source:
@Override protected void onOverScrolled(int scrollX,int scrollY,boolean clampedX,boolean clampedY){
  if (!mScroller.isFinished()) {
    final int oldX=mScrollX;
    final int oldY=mOwnScrollY;
    mScrollX=scrollX;
    mOwnScrollY=scrollY;
    if (clampedY) {
      springBack();
    }
 else {
      onScrollChanged(mScrollX,mOwnScrollY,oldX,oldY);
      invalidateParentIfNeeded();
      updateChildren();
      float overScrollTop=getCurrentOverScrollAmount(true);
      if (mOwnScrollY < 0) {
        notifyOverscrollTopListener(-mOwnScrollY,isRubberbanded(true));
      }
 else {
        notifyOverscrollTopListener(overScrollTop,isRubberbanded(true));
      }
    }
  }
 else {
    customScrollTo(scrollY);
    scrollTo(scrollX,mScrollY);
  }
}

Fixed version (ground truth):
@Override protected void onOverScrolled(int scrollX,int scrollY,boolean clampedX,boolean clampedY){
  if (!mScroller.isFinished()) {
    final int oldX=mScrollX;
    final int oldY=mOwnScrollY;
    mScrollX=scrollX;
    setOwnScrollY(scrollY);
    if (clampedY) {
      springBack();
    }
 else {
      onScrollChanged(mScrollX,mOwnScrollY,oldX,oldY);
      invalidateParentIfNeeded();
      updateChildren();
      float overScrollTop=getCurrentOverScrollAmount(true);
      if (mOwnScrollY < 0) {
        notifyOverscrollTopListener(-mOwnScrollY,isRubberbanded(true));
      }
 else {
        notifyOverscrollTopListener(overScrollTop,isRubberbanded(true));
      }
    }
  }
 else {
    customScrollTo(scrollY);
    scrollTo(scrollX,mScrollY);
  }
}
Program: 190937
Project: 190937
Buggy source:
private void clampScrollPosition(){
  int scrollRange=getScrollRange();
  if (scrollRange < mOwnScrollY) {
    mOwnScrollY=scrollRange;
  }
}

Fixed version (ground truth):
private void clampScrollPosition(){
  int scrollRange=getScrollRange();
  if (scrollRange < mOwnScrollY) {
    setOwnScrollY(scrollRange);
  }
}
Program: 190938
Project: 190938
Buggy source:
private void customScrollTo(int y){
  mOwnScrollY=y;
  updateChildren();
}

Fixed version (ground truth):
private void customScrollTo(int y){
  setOwnScrollY(y);
  updateChildren();
}
Program: 190939
Project: 190939
Buggy source:
public void resetScrollPosition(){
  mScroller.abortAnimation();
  mOwnScrollY=0;
}

Fixed version (ground truth):
public void resetScrollPosition(){
  mScroller.abortAnimation();
  setOwnScrollY(0);
}
Program: 190940
Project: 190940
Buggy source:
private void springBack(){
  int scrollRange=getScrollRange();
  boolean overScrolledTop=mOwnScrollY <= 0;
  boolean overScrolledBottom=mOwnScrollY >= scrollRange;
  if (overScrolledTop || overScrolledBottom) {
    boolean onTop;
    float newAmount;
    if (overScrolledTop) {
      onTop=true;
      newAmount=-mOwnScrollY;
      mOwnScrollY=0;
      mDontReportNextOverScroll=true;
    }
 else {
      onTop=false;
      newAmount=mOwnScrollY - scrollRange;
      mOwnScrollY=scrollRange;
    }
    setOverScrollAmount(newAmount,onTop,false);
    setOverScrollAmount(0.0f,onTop,true);
    mScroller.forceFinished(true);
  }
}

Fixed version (ground truth):
private void springBack(){
  int scrollRange=getScrollRange();
  boolean overScrolledTop=mOwnScrollY <= 0;
  boolean overScrolledBottom=mOwnScrollY >= scrollRange;
  if (overScrolledTop || overScrolledBottom) {
    boolean onTop;
    float newAmount;
    if (overScrolledTop) {
      onTop=true;
      newAmount=-mOwnScrollY;
      setOwnScrollY(0);
      mDontReportNextOverScroll=true;
    }
 else {
      onTop=false;
      newAmount=mOwnScrollY - scrollRange;
      setOwnScrollY(scrollRange);
    }
    setOverScrollAmount(newAmount,onTop,false);
    setOverScrollAmount(0.0f,onTop,true);
    mScroller.forceFinished(true);
  }
}
Program: 190941
Project: 190941
Buggy source:
private void updateScrollPositionOnExpandInBottom(ExpandableView view){
  if (view instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)view;
    if (row.isUserLocked() && row != getFirstChildNotGone()) {
      if (row.isSummaryWithChildren()) {
        return;
      }
      float endPosition=row.getTranslationY() + row.getActualHeight();
      if (row.isChildInGroup()) {
        endPosition+=row.getNotificationParent().getTranslationY();
      }
      int stackEnd=getStackEndPosition();
      if (endPosition > stackEnd) {
        mOwnScrollY+=endPosition - stackEnd;
        mDisallowScrollingInThisMotion=true;
      }
    }
  }
}

Fixed version (ground truth):
private void updateScrollPositionOnExpandInBottom(ExpandableView view){
  if (view instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)view;
    if (row.isUserLocked() && row != getFirstChildNotGone()) {
      if (row.isSummaryWithChildren()) {
        return;
      }
      float endPosition=row.getTranslationY() + row.getActualHeight();
      if (row.isChildInGroup()) {
        endPosition+=row.getNotificationParent().getTranslationY();
      }
      int stackEnd=getStackEndPosition();
      if (endPosition > stackEnd) {
        setOwnScrollY((int)(mOwnScrollY + endPosition - stackEnd));
        mDisallowScrollingInThisMotion=true;
      }
    }
  }
}
Program: 190942
Project: 190942
Buggy source:
@Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info){
  super.onInitializeAccessibilityNodeInfoInternal(info);
  final int scrollRange=getScrollRange();
  if (scrollRange > 0) {
    info.setScrollable(true);
    if (mScrollY > 0) {
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_UP);
    }
    if (mScrollY < scrollRange) {
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_DOWN);
    }
  }
  info.setClassName(ScrollView.class.getName());
}

Fixed version (ground truth):
@Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info){
  super.onInitializeAccessibilityNodeInfoInternal(info);
  if (mScrollable) {
    info.setScrollable(true);
    if (mBackwardScrollable) {
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_UP);
    }
    if (mForwardScrollable) {
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
      info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_DOWN);
    }
  }
  info.setClassName(ScrollView.class.getName());
}
Program: 190943
Project: 190943
Buggy source:
/** 
 * Perform a scroll upwards and adapt the overscroll amounts accordingly
 * @param deltaY The amount to scroll upwards, has to be positive.
 * @return The amount of scrolling to be performed by the scroller,not handled by the overScroll amount.
 */
private float overScrollUp(int deltaY,int range){
  deltaY=Math.max(deltaY,0);
  float currentTopAmount=getCurrentOverScrollAmount(true);
  float newTopAmount=currentTopAmount - deltaY;
  if (currentTopAmount > 0) {
    setOverScrollAmount(newTopAmount,true,false);
  }
  float scrollAmount=newTopAmount < 0 ? -newTopAmount : 0.0f;
  float newScrollY=mOwnScrollY + scrollAmount;
  if (newScrollY > range) {
    if (!mExpandedInThisMotion) {
      float currentBottomPixels=getCurrentOverScrolledPixels(false);
      setOverScrolledPixels(currentBottomPixels + newScrollY - range,false,false);
    }
    mOwnScrollY=range;
    scrollAmount=0.0f;
  }
  return scrollAmount;
}

Fixed version (ground truth):
/** 
 * Perform a scroll upwards and adapt the overscroll amounts accordingly
 * @param deltaY The amount to scroll upwards, has to be positive.
 * @return The amount of scrolling to be performed by the scroller,not handled by the overScroll amount.
 */
private float overScrollUp(int deltaY,int range){
  deltaY=Math.max(deltaY,0);
  float currentTopAmount=getCurrentOverScrollAmount(true);
  float newTopAmount=currentTopAmount - deltaY;
  if (currentTopAmount > 0) {
    setOverScrollAmount(newTopAmount,true,false);
  }
  float scrollAmount=newTopAmount < 0 ? -newTopAmount : 0.0f;
  float newScrollY=mOwnScrollY + scrollAmount;
  if (newScrollY > range) {
    if (!mExpandedInThisMotion) {
      float currentBottomPixels=getCurrentOverScrolledPixels(false);
      setOverScrolledPixels(currentBottomPixels + newScrollY - range,false,false);
    }
    setOwnScrollY(range);
    scrollAmount=0.0f;
  }
  return scrollAmount;
}
Program: 190945
Project: 190945
Buggy source:
private int calculatePanelHeightQsExpanded(){
  float notificationHeight=mNotificationStackScroller.getHeight() - mNotificationStackScroller.getEmptyBottomMargin() - mNotificationStackScroller.getTopPadding();
  if (mNotificationStackScroller.getNotGoneChildCount() == 0 && mShadeEmpty) {
    notificationHeight=mNotificationStackScroller.getEmptyShadeViewHeight() + mNotificationStackScroller.getBottomStackPeekSize() + mNotificationStackScroller.getBottomStackSlowDownHeight();
  }
  int maxQsHeight=mQsMaxExpansionHeight;
  if (mQsSizeChangeAnimator != null) {
    maxQsHeight=(int)mQsSizeChangeAnimator.getAnimatedValue();
  }
  float totalHeight=Math.max(maxQsHeight,mStatusBarState == StatusBarState.KEYGUARD ? mClockPositionResult.stackScrollerPadding - mTopPaddingAdjustment : 0) + notificationHeight;
  if (totalHeight > mNotificationStackScroller.getHeight()) {
    float fullyCollapsedHeight=maxQsHeight + mNotificationStackScroller.getLayoutMinHeight();
    totalHeight=Math.max(fullyCollapsedHeight,mNotificationStackScroller.getHeight());
  }
  return (int)totalHeight;
}

Fixed version (ground truth):
private int calculatePanelHeightQsExpanded(){
  float notificationHeight=mNotificationStackScroller.getHeight() - mNotificationStackScroller.getEmptyBottomMargin() - mNotificationStackScroller.getTopPadding();
  if (mNotificationStackScroller.getNotGoneChildCount() == 0 && mShadeEmpty) {
    notificationHeight=mNotificationStackScroller.getEmptyShadeViewHeight() + mNotificationStackScroller.getBottomStackPeekSize() + mNotificationStackScroller.getBottomStackSlowDownHeight();
  }
  int maxQsHeight=mQsMaxExpansionHeight;
  if (mQsSizeChangeAnimator != null) {
    maxQsHeight=(int)mQsSizeChangeAnimator.getAnimatedValue();
  }
  float totalHeight=Math.max(maxQsHeight,mStatusBarState == StatusBarState.KEYGUARD ? mClockPositionResult.stackScrollerPadding - mTopPaddingAdjustment : 0) + notificationHeight + mNotificationStackScroller.getTopPaddingOverflow();
  if (totalHeight > mNotificationStackScroller.getHeight()) {
    float fullyCollapsedHeight=maxQsHeight + mNotificationStackScroller.getLayoutMinHeight();
    totalHeight=Math.max(fullyCollapsedHeight,mNotificationStackScroller.getHeight());
  }
  return (int)totalHeight;
}
Program: 190946
Project: 190946
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  int oldMaxHeight=mQsMaxExpansionHeight;
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mQsContainer.getQsMinExpansionHeight();
  mQsMaxExpansionHeight=mQsContainer.getDesiredHeight();
  positionClockAndNotifications();
  if (mQsExpanded && mQsFullyExpanded) {
    mQsExpansionHeight=mQsMaxExpansionHeight;
    requestScrollerTopPaddingUpdate(false);
    requestPanelHeightUpdate();
    if (mQsMaxExpansionHeight != oldMaxHeight) {
      startQsSizeChangeAnimation(oldMaxHeight,mQsMaxExpansionHeight);
    }
  }
 else   if (!mQsExpanded) {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
  }
  updateStackHeight(getExpandedHeight());
  updateHeader();
  if (mQsSizeChangeAnimator == null) {
    mQsContainer.setHeightOverride(mQsContainer.getDesiredHeight());
  }
  updateMaxHeadsUpTranslation();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  int oldMaxHeight=mQsMaxExpansionHeight;
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mQsContainer.getQsMinExpansionHeight();
  mQsMaxExpansionHeight=mQsContainer.getDesiredHeight();
  positionClockAndNotifications();
  if (mQsExpanded && mQsFullyExpanded) {
    mQsExpansionHeight=mQsMaxExpansionHeight;
    requestScrollerTopPaddingUpdate(false);
    requestPanelHeightUpdate();
    if (mQsMaxExpansionHeight != oldMaxHeight) {
      startQsSizeChangeAnimation(oldMaxHeight,mQsMaxExpansionHeight);
    }
  }
 else   if (!mQsExpanded) {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
  }
  updateExpandedHeight(getExpandedHeight());
  updateHeader();
  if (mQsSizeChangeAnimator == null) {
    mQsContainer.setHeightOverride(mQsContainer.getDesiredHeight());
  }
  updateMaxHeadsUpTranslation();
}
Program: 190947
Project: 190947
Buggy source:
@Override protected void onHeightUpdated(float expandedHeight){
  if (!mQsExpanded || mQsExpandImmediate || mIsExpanding && mQsExpandedWhenExpandingStarted) {
    positionClockAndNotifications();
  }
  if (mQsExpandImmediate || mQsExpanded && !mQsTracking && mQsExpansionAnimator == null && !mQsExpansionFromOverscroll) {
    float t;
    if (mKeyguardShowing) {
      t=expandedHeight / getMaxPanelHeight();
    }
 else {
      float panelHeightQsCollapsed=mNotificationStackScroller.getIntrinsicPadding() + mNotificationStackScroller.getLayoutMinHeight();
      float panelHeightQsExpanded=calculatePanelHeightQsExpanded();
      t=(expandedHeight - panelHeightQsCollapsed) / (panelHeightQsExpanded - panelHeightQsCollapsed);
    }
    setQsExpansion(mQsMinExpansionHeight + t * (getTempQsMaxExpansion() - mQsMinExpansionHeight));
  }
  updateStackHeight(expandedHeight);
  updateHeader();
  updateUnlockIcon();
  updateNotificationTranslucency();
  updatePanelExpanded();
  mNotificationStackScroller.setShadeExpanded(!isFullyCollapsed());
  if (DEBUG) {
    invalidate();
  }
}

Fixed version (ground truth):
@Override protected void onHeightUpdated(float expandedHeight){
  if (!mQsExpanded || mQsExpandImmediate || mIsExpanding && mQsExpandedWhenExpandingStarted) {
    positionClockAndNotifications();
  }
  if (mQsExpandImmediate || mQsExpanded && !mQsTracking && mQsExpansionAnimator == null && !mQsExpansionFromOverscroll) {
    float t;
    if (mKeyguardShowing) {
      t=expandedHeight / getMaxPanelHeight();
    }
 else {
      float panelHeightQsCollapsed=mNotificationStackScroller.getIntrinsicPadding() + mNotificationStackScroller.getLayoutMinHeight();
      float panelHeightQsExpanded=calculatePanelHeightQsExpanded();
      t=(expandedHeight - panelHeightQsCollapsed) / (panelHeightQsExpanded - panelHeightQsCollapsed);
    }
    setQsExpansion(mQsMinExpansionHeight + t * (getTempQsMaxExpansion() - mQsMinExpansionHeight));
  }
  updateExpandedHeight(expandedHeight);
  updateHeader();
  updateUnlockIcon();
  updateNotificationTranslucency();
  updatePanelExpanded();
  mNotificationStackScroller.setShadeExpanded(!isFullyCollapsed());
  if (DEBUG) {
    invalidate();
  }
}
Program: 190948
Project: 190948
Buggy source:
@Override public void onHeightChanged(ExpandableView view,boolean needsAnimation){
  if (view == null && mQsExpanded) {
    return;
  }
  requestPanelHeightUpdate();
}

Fixed version (ground truth):
@Override public void onHeightChanged(ExpandableView view,boolean needsAnimation){
  if (view == null && mQsExpanded) {
    return;
  }
  ExpandableView firstChildNotGone=mNotificationStackScroller.getFirstChildNotGone();
  ExpandableNotificationRow firstRow=firstChildNotGone instanceof ExpandableNotificationRow ? (ExpandableNotificationRow)firstChildNotGone : null;
  if (firstRow != null && (view == firstRow || (firstRow.getNotificationParent() == firstRow))) {
    requestScrollerTopPaddingUpdate(false);
  }
  requestPanelHeightUpdate();
}
Program: 190949
Project: 190949
Buggy source:
/** 
 * Positions the clock and notifications dynamically depending on how many notifications are showing.
 */
private void positionClockAndNotifications(){
  boolean animate=mNotificationStackScroller.isAddOrRemoveAnimationPending();
  int stackScrollerPadding;
  if (mStatusBarState != StatusBarState.KEYGUARD) {
    int bottom=mQsContainer.getHeader().getHeight();
    stackScrollerPadding=mStatusBarState == StatusBarState.SHADE ? bottom + mQsPeekHeight : mKeyguardStatusBar.getHeight();
    mTopPaddingAdjustment=0;
  }
 else {
    mClockPositionAlgorithm.setup(mStatusBar.getMaxKeyguardNotifications(),getMaxPanelHeight(),getExpandedHeight(),mNotificationStackScroller.getNotGoneChildCount(),getHeight(),mKeyguardStatusView.getHeight(),mEmptyDragAmount);
    mClockPositionAlgorithm.run(mClockPositionResult);
    if (animate || mClockAnimator != null) {
      startClockAnimation(mClockPositionResult.clockY);
    }
 else {
      mKeyguardStatusView.setY(mClockPositionResult.clockY);
    }
    updateClock(mClockPositionResult.clockAlpha,mClockPositionResult.clockScale);
    stackScrollerPadding=mClockPositionResult.stackScrollerPadding;
    mTopPaddingAdjustment=mClockPositionResult.stackScrollerPaddingAdjustment;
  }
  mNotificationStackScroller.setIntrinsicPadding(stackScrollerPadding);
  requestScrollerTopPaddingUpdate(animate);
}

Fixed version (ground truth):
/** 
 * Positions the clock and notifications dynamically depending on how many notifications are showing.
 */
private void positionClockAndNotifications(){
  boolean animate=mNotificationStackScroller.isAddOrRemoveAnimationPending();
  int stackScrollerPadding;
  if (mStatusBarState != StatusBarState.KEYGUARD) {
    stackScrollerPadding=mQsContainer.getHeader().getHeight() + mQsPeekHeight;
    mTopPaddingAdjustment=0;
  }
 else {
    mClockPositionAlgorithm.setup(mStatusBar.getMaxKeyguardNotifications(),getMaxPanelHeight(),getExpandedHeight(),mNotificationStackScroller.getNotGoneChildCount(),getHeight(),mKeyguardStatusView.getHeight(),mEmptyDragAmount);
    mClockPositionAlgorithm.run(mClockPositionResult);
    if (animate || mClockAnimator != null) {
      startClockAnimation(mClockPositionResult.clockY);
    }
 else {
      mKeyguardStatusView.setY(mClockPositionResult.clockY);
    }
    updateClock(mClockPositionResult.clockAlpha,mClockPositionResult.clockScale);
    stackScrollerPadding=mClockPositionResult.stackScrollerPadding;
    mTopPaddingAdjustment=mClockPositionResult.stackScrollerPaddingAdjustment;
  }
  mNotificationStackScroller.setIntrinsicPadding(stackScrollerPadding);
  requestScrollerTopPaddingUpdate(animate);
}
Program: 190950
Project: 190950
Buggy source:
private void updateQsState(){
  mQsContainer.setExpanded(mQsExpanded);
  mNotificationStackScroller.setScrollingEnabled(mStatusBarState != StatusBarState.KEYGUARD && (!mQsExpanded || mQsExpansionFromOverscroll));
  updateEmptyShadeView();
  mQsNavbarScrim.setVisibility(mStatusBarState == StatusBarState.SHADE && mQsExpanded && !mStackScrollerOverscrolling && mQsScrimEnabled ? View.VISIBLE : View.INVISIBLE);
  if (mKeyguardUserSwitcher != null && mQsExpanded && !mStackScrollerOverscrolling) {
    mKeyguardUserSwitcher.hideIfNotSimple(true);
  }
}

Fixed version (ground truth):
private void updateQsState(){
  mQsContainer.setExpanded(mQsExpanded);
  mNotificationStackScroller.setQsExpanded(mQsExpanded);
  mNotificationStackScroller.setScrollingEnabled(mStatusBarState != StatusBarState.KEYGUARD && (!mQsExpanded || mQsExpansionFromOverscroll));
  updateEmptyShadeView();
  mQsNavbarScrim.setVisibility(mStatusBarState == StatusBarState.SHADE && mQsExpanded && !mStackScrollerOverscrolling && mQsScrimEnabled ? View.VISIBLE : View.INVISIBLE);
  if (mKeyguardUserSwitcher != null && mQsExpanded && !mStackScrollerOverscrolling) {
    mKeyguardUserSwitcher.hideIfNotSimple(true);
  }
}
Program: 190951
Project: 190951
Buggy source:
public int getInnerHeight(){
  return mLayoutHeight - mTopPadding;
}

Fixed version (ground truth):
public int getInnerHeight(){
  return Math.max(mLayoutHeight - mTopPadding,mLayoutMinHeight);
}
Program: 190952
Project: 190952
Buggy source:
private void snapToGear(View animView,float velocity){
  final float snapBackThreshold=getSpaceForGear(animView);
  final float target=mCurrIconRow.isIconOnLeft() ? snapBackThreshold : -snapBackThreshold;
  mGearExposedView=mTranslatingParentView;
  if (animView instanceof ExpandableNotificationRow) {
    MetricsLogger.action(mContext,MetricsEvent.ACTION_REVEAL_GEAR,((ExpandableNotificationRow)animView).getStatusBarNotification().getPackageName());
  }
  if (mCurrIconRow != null) {
    mCurrIconRow.setSnapping(true);
    setSnappedToGear(true);
  }
  onDragCancelled(animView);
  if (mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD) {
    mHandler.removeCallbacks(mFalsingCheck);
    mHandler.postDelayed(mFalsingCheck,COVER_GEAR_DELAY);
  }
  super.snapChild(animView,target,velocity);
}

Fixed version (ground truth):
private void snapToGear(View animView,float velocity){
  final float snapBackThreshold=getSpaceForGear(animView);
  final float target=mCurrIconRow.isIconOnLeft() ? snapBackThreshold : -snapBackThreshold;
  mGearExposedView=mTranslatingParentView;
  if (animView instanceof ExpandableNotificationRow) {
    MetricsLogger.action(mContext,MetricsEvent.ACTION_REVEAL_GEAR,((ExpandableNotificationRow)animView).getStatusBarNotification().getPackageName());
  }
  if (mCurrIconRow != null) {
    mCurrIconRow.setSnapping(true);
    setSnappedToGear(true);
  }
  onDragCancelled(animView);
  if (isAntiFalsingNeeded()) {
    mHandler.removeCallbacks(mFalsingCheck);
    mHandler.postDelayed(mFalsingCheck,COVER_GEAR_DELAY);
  }
  super.snapChild(animView,target,velocity);
}
Program: 190953
Project: 190953
Buggy source:
@Override public void onHeightChanged(ExpandableView view,boolean needsAnimation){
  updateContentHeight();
  updateScrollPositionOnExpandInBottom(view);
  clampScrollPosition();
  notifyHeightChangeListener(view);
  if (needsAnimation) {
    ExpandableNotificationRow row=view instanceof ExpandableNotificationRow ? (ExpandableNotificationRow)view : null;
    requestAnimationOnViewResize(row);
  }
  requestChildrenUpdate();
}

Fixed version (ground truth):
@Override public void onHeightChanged(ExpandableView view,boolean needsAnimation){
  updateContentHeight();
  updateScrollPositionOnExpandInBottom(view);
  clampScrollPosition();
  notifyHeightChangeListener(view);
  ExpandableNotificationRow row=view instanceof ExpandableNotificationRow ? (ExpandableNotificationRow)view : null;
  if (row != null && (row == mFirstVisibleBackgroundChild || row.getNotificationParent() == mFirstVisibleBackgroundChild)) {
    updateAlgorithmLayoutMinHeight();
  }
  if (needsAnimation) {
    requestAnimationOnViewResize(row);
  }
  requestChildrenUpdate();
}
Program: 190954
Project: 190954
Buggy source:
private int findDarkAnimationOriginIndex(@Nullable PointF screenLocation){
  if (screenLocation == null || screenLocation.y < mTopPadding + mTopPaddingOverflow) {
    return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
  }
  if (screenLocation.y > getBottomMostNotificationBottom()) {
    return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW;
  }
  View child=getClosestChildAtRawPosition(screenLocation.x,screenLocation.y);
  if (child != null) {
    return getNotGoneIndex(child);
  }
 else {
    return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
  }
}

Fixed version (ground truth):
private int findDarkAnimationOriginIndex(@Nullable PointF screenLocation){
  if (screenLocation == null || screenLocation.y < mTopPadding) {
    return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
  }
  if (screenLocation.y > getBottomMostNotificationBottom()) {
    return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW;
  }
  View child=getClosestChildAtRawPosition(screenLocation.x,screenLocation.y);
  if (child != null) {
    return getNotGoneIndex(child);
  }
 else {
    return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
  }
}
Program: 190955
Project: 190955
Buggy source:
/** 
 * Updates the top padding of the notifications, taking   {@link #getIntrinsicPadding()} intoaccount.
 * @param qsHeight the top padding imposed by the quick settings panel
 * @param animate whether to animate the change
 * @param ignoreIntrinsicPadding if true, {@link #getIntrinsicPadding()} is ignored and{@code qsHeight} is the final top padding
 */
public void updateTopPadding(float qsHeight,boolean animate,boolean ignoreIntrinsicPadding){
  float start=qsHeight;
  float stackHeight=getHeight() - start;
  int minStackHeight=getLayoutMinHeight();
  if (stackHeight <= minStackHeight) {
    float overflow=minStackHeight - stackHeight;
    stackHeight=minStackHeight;
    start=getHeight() - stackHeight;
    mTopPaddingOverflow=overflow;
  }
 else {
    mTopPaddingOverflow=0;
  }
  setTopPadding(ignoreIntrinsicPadding ? (int)start : clampPadding((int)start),animate);
  setStackHeight(mLastSetStackHeight);
}

Fixed version (ground truth):
/** 
 * Updates the top padding of the notifications, taking   {@link #getIntrinsicPadding()} intoaccount.
 * @param qsHeight the top padding imposed by the quick settings panel
 * @param animate whether to animate the change
 * @param ignoreIntrinsicPadding if true, {@link #getIntrinsicPadding()} is ignored and{@code qsHeight} is the final top padding
 */
public void updateTopPadding(float qsHeight,boolean animate,boolean ignoreIntrinsicPadding){
  int topPadding=(int)qsHeight;
  int minStackHeight=getLayoutMinHeight();
  if (topPadding + minStackHeight > getHeight()) {
    mTopPaddingOverflow=topPadding + minStackHeight - getHeight();
  }
 else {
    mTopPaddingOverflow=0;
  }
  setTopPadding(ignoreIntrinsicPadding ? topPadding : clampPadding(topPadding),animate);
  setExpandedHeight(mExpandedHeight);
}
Program: 190956
Project: 190956
Buggy source:
public int getLayoutMinHeight(){
  int firstChildMinHeight=getFirstChildIntrinsicHeight();
  return Math.min(firstChildMinHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight,mMaxLayoutHeight - mTopPadding);
}

Fixed version (ground truth):
public int getLayoutMinHeight(){
  int firstChildMinHeight=getFirstChildIntrinsicHeight();
  return Math.min(firstChildMinHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight,mMaxLayoutHeight - mIntrinsicPadding);
}
Program: 190957
Project: 190957
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  float centerX=getWidth() / 2.0f;
  for (int i=0; i < getChildCount(); i++) {
    View child=getChildAt(i);
    float width=child.getMeasuredWidth();
    float height=child.getMeasuredHeight();
    child.layout((int)(centerX - width / 2.0f),0,(int)(centerX + width / 2.0f),(int)height);
  }
  setMaxLayoutHeight(getHeight());
  updateContentHeight();
  clampScrollPosition();
  requestChildrenUpdate();
  updateFirstAndLastBackgroundViews();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  float centerX=getWidth() / 2.0f;
  for (int i=0; i < getChildCount(); i++) {
    View child=getChildAt(i);
    float width=child.getMeasuredWidth();
    float height=child.getMeasuredHeight();
    child.layout((int)(centerX - width / 2.0f),0,(int)(centerX + width / 2.0f),(int)height);
  }
  setMaxLayoutHeight(getHeight());
  updateContentHeight();
  clampScrollPosition();
  requestChildrenUpdate();
  updateFirstAndLastBackgroundViews();
  updateAlgorithmLayoutMinHeight();
}
Program: 190958
Project: 190958
Buggy source:
@Override public boolean isAntiFalsingNeeded(){
  return mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD;
}

Fixed version (ground truth):
@Override public boolean isAntiFalsingNeeded(){
  return onKeyguard();
}
Program: 190959
Project: 190959
Buggy source:
/** 
 * @return the position from where the appear transition ends when expanding.Measured in absolute height.
 */
private float getAppearEndPosition(){
  int firstItemHeight=mTrackingHeadsUp || mHeadsUpManager.hasPinnedHeadsUp() ? mHeadsUpManager.getTopHeadsUpPinnedHeight() + mBottomStackPeekSize + mBottomStackSlowDownHeight : getLayoutMinHeight();
  return firstItemHeight + mTopPadding + mTopPaddingOverflow;
}

Fixed version (ground truth):
/** 
 * @return the position from where the appear transition ends when expanding.Measured in absolute height.
 */
private float getAppearEndPosition(){
  int firstItemHeight=mTrackingHeadsUp || mHeadsUpManager.hasPinnedHeadsUp() ? mHeadsUpManager.getTopHeadsUpPinnedHeight() + mBottomStackPeekSize + mBottomStackSlowDownHeight : getLayoutMinHeight();
  return firstItemHeight + (onKeyguard() ? mTopPadding : mIntrinsicPadding);
}
Program: 190960
Project: 190960
Buggy source:
private void updateAlgorithmHeightAndPadding(){
  mAmbientState.setLayoutHeight(getLayoutHeight());
  mAmbientState.setTopPadding(mTopPadding);
}

Fixed version (ground truth):
private void updateAlgorithmHeightAndPadding(){
  mAmbientState.setLayoutHeight(getLayoutHeight());
  updateAlgorithmLayoutMinHeight();
  mAmbientState.setTopPadding(mTopPadding);
}
Program: 190961
Project: 190961
Buggy source:
/** 
 * @return The translation at the beginning when expanding.Measured relative to the resting position.
 */
private float getExpandTranslationStart(){
  int startPosition=mTrackingHeadsUp || mHeadsUpManager.hasPinnedHeadsUp() ? 0 : -getFirstChildIntrinsicHeight();
  return startPosition - mTopPadding;
}

Fixed version (ground truth):
/** 
 * @return The translation at the beginning when expanding.Measured relative to the resting position.
 */
private float getExpandTranslationStart(){
  int startPosition=0;
  if (!mTrackingHeadsUp && !mHeadsUpManager.hasPinnedHeadsUp()) {
    startPosition=-Math.min(getFirstChildIntrinsicHeight(),mMaxLayoutHeight - mIntrinsicPadding - mBottomStackSlowDownHeight- mBottomStackPeekSize);
  }
  return startPosition - mTopPadding;
}
Program: 190963
Project: 190963
Buggy source:
@Override protected Layout makeSingleLayout(int wantWidth,BoringLayout.Metrics boring,int ellipsisWidth,Layout.Alignment alignment,boolean shouldEllipsize,TextUtils.TruncateAt effectiveEllipsize,boolean useSaved){
  CharSequence text=getText() == null ? "String_Node_Str" : getText();
  StaticLayout.Builder builder=StaticLayout.Builder.obtain(text,0,text.length(),getPaint(),wantWidth).setAlignment(alignment).setTextDirection(getTextDirectionHeuristic()).setLineSpacing(getLineSpacingExtra(),getLineSpacingMultiplier()).setIncludePad(getIncludeFontPadding()).setEllipsize(shouldEllipsize ? effectiveEllipsize : null).setEllipsizedWidth(ellipsisWidth).setBreakStrategy(Layout.BREAK_STRATEGY_HIGH_QUALITY).setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL);
  int endMargin=getContext().getResources().getDimensionPixelSize(R.dimen.notification_content_picture_margin);
  int[] margins=null;
  if (mIndentLines > 0) {
    margins=new int[mIndentLines + 1];
    for (int i=0; i < mIndentLines; i++) {
      margins[i]=endMargin;
    }
  }
  if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
    builder.setIndents(margins,null);
  }
 else {
    builder.setIndents(null,margins);
  }
  return builder.build();
}

Fixed version (ground truth):
@Override protected Layout makeSingleLayout(int wantWidth,BoringLayout.Metrics boring,int ellipsisWidth,Layout.Alignment alignment,boolean shouldEllipsize,TextUtils.TruncateAt effectiveEllipsize,boolean useSaved){
  CharSequence text=getText() == null ? "String_Node_Str" : getText();
  StaticLayout.Builder builder=StaticLayout.Builder.obtain(text,0,text.length(),getPaint(),wantWidth).setAlignment(alignment).setTextDirection(getTextDirectionHeuristic()).setLineSpacing(getLineSpacingExtra(),getLineSpacingMultiplier()).setIncludePad(getIncludeFontPadding()).setEllipsize(shouldEllipsize ? effectiveEllipsize : null).setEllipsizedWidth(ellipsisWidth).setBreakStrategy(Layout.BREAK_STRATEGY_HIGH_QUALITY).setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL);
  int endMargin=getContext().getResources().getDimensionPixelSize(R.dimen.notification_content_picture_margin);
  int[] margins=null;
  if (mIndentLines > 0) {
    margins=new int[mIndentLines + 1];
    for (int i=0; i < mIndentLines; i++) {
      margins[i]=endMargin;
    }
  }
  if (mResolvedDirection == LAYOUT_DIRECTION_RTL) {
    builder.setIndents(margins,null);
  }
 else {
    builder.setIndents(null,margins);
  }
  return builder.build();
}
Program: 190964
Project: 190964
Buggy source:
/** 
 * Fades the background when the dimmed state changes.
 */
private void fadeDimmedBackground(){
  mBackgroundDimmed.animate().cancel();
  mBackgroundNormal.animate().cancel();
  if (mActivated) {
    updateBackground();
    return;
  }
  if (!shouldHideBackground()) {
    if (mDimmed) {
      mBackgroundDimmed.setVisibility(View.VISIBLE);
    }
 else {
      mBackgroundNormal.setVisibility(View.VISIBLE);
    }
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      updateBackground();
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.addUpdateListener(mBackgroundVisibilityUpdater);
  mBackgroundAnimator.start();
}

Fixed version (ground truth):
/** 
 * Fades the background when the dimmed state changes.
 */
private void fadeDimmedBackground(){
  mBackgroundDimmed.animate().cancel();
  mBackgroundNormal.animate().cancel();
  if (mActivated) {
    updateBackground();
    return;
  }
  if (!shouldHideBackground()) {
    if (mDimmed) {
      mBackgroundDimmed.setVisibility(View.VISIBLE);
    }
 else {
      mBackgroundNormal.setVisibility(View.VISIBLE);
    }
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      updateBackground();
      mBackgroundAnimator=null;
      if (mFadeInFromDarkAnimator == null) {
        mDimmedBackgroundFadeInAmount=-1;
      }
    }
  }
);
  mBackgroundAnimator.addUpdateListener(mBackgroundVisibilityUpdater);
  mBackgroundAnimator.start();
}
Program: 190965
Project: 190965
Buggy source:
private void deleteDocuments(final Selection selected){
  Metrics.logUserAction(getContext(),Metrics.USER_ACTION_DELETE);
  assert(!selected.isEmpty());
  final DocumentInfo srcParent=getDisplayState().stack.peek();
  new GetDocumentsTask(){
    @Override void onDocumentsReady(    final List<DocumentInfo> docs){
      TextView message=(TextView)mInflater.inflate(R.layout.dialog_delete_confirmation,null);
      message.setText(generateDeleteMessage(docs));
      new AlertDialog.Builder(getActivity()).setView(message).setPositiveButton(android.R.string.yes,new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int id){
          if (mActionMode != null) {
            mActionMode.finish();
          }
 else {
            Log.w(TAG,"String_Node_Str");
          }
          mAdapter.hide(selected.getAll());
          FileOperations.delete(getActivity(),docs,srcParent,getDisplayState().stack);
        }
      }
).setNegativeButton(android.R.string.no,null).show();
    }
  }
.execute(selected);
}

Fixed version (ground truth):
private void deleteDocuments(final Selection selected){
  Metrics.logUserAction(getContext(),Metrics.USER_ACTION_DELETE);
  if (selected.isEmpty()) {
    return;
  }
  final DocumentInfo srcParent=getDisplayState().stack.peek();
  new GetDocumentsTask(){
    @Override void onDocumentsReady(    final List<DocumentInfo> docs){
      TextView message=(TextView)mInflater.inflate(R.layout.dialog_delete_confirmation,null);
      message.setText(generateDeleteMessage(docs));
      new AlertDialog.Builder(getActivity()).setView(message).setPositiveButton(android.R.string.yes,new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int id){
          if (mActionMode != null) {
            mActionMode.finish();
          }
 else {
            Log.w(TAG,"String_Node_Str");
          }
          mAdapter.hide(selected.getAll());
          FileOperations.delete(getActivity(),docs,srcParent,getDisplayState().stack);
        }
      }
).setNegativeButton(android.R.string.no,null).show();
    }
  }
.execute(selected);
}
Program: 190968
Project: 190968
Buggy source:
/** 
 * Confirm passkey for   {@link #PAIRING_VARIANT_PASSKEY_CONFIRMATION} pairing.<p>Requires  {@link android.Manifest.permission#BLUETOOTH_ADMIN}.
 * @return true confirmation has been sent outfalse for error
 */
public boolean setPairingConfirmation(boolean confirm){
  if (sService == null) {
    Log.e(TAG,"String_Node_Str");
    return false;
  }
  try {
    return sService.setPairingConfirmation(this,confirm);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Confirm passkey for   {@link #PAIRING_VARIANT_PASSKEY_CONFIRMATION} pairing.<p>Requires  {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}.
 * @return true confirmation has been sent outfalse for error
 */
public boolean setPairingConfirmation(boolean confirm){
  if (sService == null) {
    Log.e(TAG,"String_Node_Str");
    return false;
  }
  try {
    return sService.setPairingConfirmation(this,confirm);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
  return false;
}
Program: 190969
Project: 190969
Buggy source:
/** 
 * Confirm passkey for   {@link #PAIRING_VARIANT_PASSKEY_CONFIRMATION} pairing.<p>Requires  {@link android.Manifest.permission#BLUETOOTH_ADMIN}.
 * @return true confirmation has been sent outfalse for error
 */
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) public boolean setPairingConfirmation(boolean confirm){
  if (sService == null) {
    Log.e(TAG,"String_Node_Str");
    return false;
  }
  try {
    return sService.setPairingConfirmation(this,confirm);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Confirm passkey for   {@link #PAIRING_VARIANT_PASSKEY_CONFIRMATION} pairing.<p>Requires  {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}.
 * @return true confirmation has been sent outfalse for error
 */
@RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setPairingConfirmation(boolean confirm){
  if (sService == null) {
    Log.e(TAG,"String_Node_Str");
    return false;
  }
  try {
    return sService.setPairingConfirmation(this,confirm);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
  return false;
}