Program: 192052
Project: 192052
Buggy source:
/** 
 * Computes the stack and task rects.  The given task stack bounds already has the top/right insets and left/right padding already applied.
 */
public void initialize(Rect windowRect,Rect taskStackBounds,StackState state){
  SystemServicesProxy ssp=Recents.getSystemServices();
  Rect lastStackRect=new Rect(mStackRect);
  Rect displayRect=ssp.getDisplayRect();
  int topMargin=getScaleForExtent(windowRect,displayRect,mBaseTopMargin,mMinMargin,HEIGHT);
  int bottomMargin=getScaleForExtent(windowRect,displayRect,mBaseBottomMargin,mMinMargin,HEIGHT);
  mInitialTopOffset=getScaleForExtent(windowRect,displayRect,mBaseInitialTopOffset,mMinMargin,HEIGHT);
  mInitialBottomOffset=mBaseInitialBottomOffset;
  mState=state;
  mStackBottomOffset=mSystemInsets.bottom + bottomMargin;
  state.computeRects(mFreeformRect,mStackRect,taskStackBounds,topMargin,mFreeformStackGap,mStackBottomOffset);
  mStackActionButtonRect.set(mStackRect.left,mStackRect.top - topMargin,mStackRect.right,mStackRect.top + mFocusedTopPeekHeight);
  float aspect=(float)(windowRect.width() - (mSystemInsets.left + mSystemInsets.right)) / (windowRect.height() - (mSystemInsets.top + mSystemInsets.bottom));
  int minHeight=mStackRect.height() - mInitialTopOffset - mStackBottomOffset;
  int height=(int)Math.min(mStackRect.width() / aspect,minHeight);
  mTaskRect.set(mStackRect.left,mStackRect.top,mStackRect.right,mStackRect.top + height);
  if (!lastStackRect.equals(mStackRect)) {
    mUnfocusedCurve=constructUnfocusedCurve();
    mUnfocusedCurveInterpolator=new FreePathInterpolator(mUnfocusedCurve);
    mFocusedCurve=constructFocusedCurve();
    mFocusedCurveInterpolator=new FreePathInterpolator(mFocusedCurve);
    mUnfocusedDimCurve=constructUnfocusedDimCurve();
    mUnfocusedDimCurveInterpolator=new FreePathInterpolator(mUnfocusedDimCurve);
    mFocusedDimCurve=constructFocusedDimCurve();
    mFocusedDimCurveInterpolator=new FreePathInterpolator(mFocusedDimCurve);
    updateFrontBackTransforms();
  }
}

Fixed version (ground truth):
/** 
 * Computes the stack and task rects.  The given task stack bounds already has the top/right insets and left/right padding already applied.
 */
public void initialize(Rect windowRect,Rect taskStackBounds,StackState state){
  SystemServicesProxy ssp=Recents.getSystemServices();
  Rect lastStackRect=new Rect(mStackRect);
  Rect displayRect=ssp.getDisplayRect();
  int topMargin=getScaleForExtent(windowRect,displayRect,mBaseTopMargin,mMinMargin,HEIGHT);
  int bottomMargin=getScaleForExtent(windowRect,displayRect,mBaseBottomMargin,mMinMargin,HEIGHT);
  mInitialTopOffset=getScaleForExtent(windowRect,displayRect,mBaseInitialTopOffset,mMinMargin,HEIGHT);
  mInitialBottomOffset=mBaseInitialBottomOffset;
  mState=state;
  mStackBottomOffset=mSystemInsets.bottom + bottomMargin;
  state.computeRects(mFreeformRect,mStackRect,taskStackBounds,topMargin,mFreeformStackGap,mStackBottomOffset);
  mStackActionButtonRect.set(mStackRect.left,mStackRect.top - topMargin,mStackRect.right,mStackRect.top + mFocusedTopPeekHeight);
  int height=mStackRect.height() - mInitialTopOffset - mStackBottomOffset;
  mTaskRect.set(mStackRect.left,mStackRect.top,mStackRect.right,mStackRect.top + height);
  if (!lastStackRect.equals(mStackRect)) {
    mUnfocusedCurve=constructUnfocusedCurve();
    mUnfocusedCurveInterpolator=new FreePathInterpolator(mUnfocusedCurve);
    mFocusedCurve=constructFocusedCurve();
    mFocusedCurveInterpolator=new FreePathInterpolator(mFocusedCurve);
    mUnfocusedDimCurve=constructUnfocusedDimCurve();
    mUnfocusedDimCurveInterpolator=new FreePathInterpolator(mUnfocusedDimCurve);
    mFocusedDimCurve=constructFocusedDimCurve();
    mFocusedDimCurveInterpolator=new FreePathInterpolator(mFocusedDimCurve);
    updateFrontBackTransforms();
  }
}