Program: 192491
Project: 192491
Buggy source:
/** 
 * Creates the activity options for an app->recents transition.
 */
private ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo topTask,TaskStackView stackView){
  if (topTask.stackId == FREEFORM_WORKSPACE_STACK_ID) {
    ArrayList<AppTransitionAnimationSpec> specs=new ArrayList<>();
    ArrayList<Task> tasks=stackView.getStack().getStackTasks();
    TaskStackLayoutAlgorithm stackLayout=stackView.getStackAlgorithm();
    TaskStackViewScroller stackScroller=stackView.getScroller();
    stackView.updateToInitialState();
    for (int i=tasks.size() - 1; i >= 0; i--) {
      Task task=tasks.get(i);
      if (task.isFreeformTask()) {
        mTmpTransform=stackLayout.getStackTransformScreenCoordinates(task,stackScroller.getStackScroll(),mTmpTransform,null);
        Rect toTaskRect=new Rect();
        mTmpTransform.rect.round(toTaskRect);
        Bitmap thumbnail=getThumbnailBitmap(topTask,task,mTmpTransform);
        specs.add(new AppTransitionAnimationSpec(task.key.id,thumbnail,toTaskRect));
      }
    }
    AppTransitionAnimationSpec[] specsArray=new AppTransitionAnimationSpec[specs.size()];
    specs.toArray(specsArray);
    return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,specsArray,mHandler,null,this);
  }
 else {
    Task toTask=new Task();
    TaskViewTransform toTransform=getThumbnailTransitionTransform(stackView,toTask);
    RectF toTaskRect=toTransform.rect;
    Bitmap thumbnail=getThumbnailBitmap(topTask,toTask,toTransform);
    if (thumbnail != null) {
      return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,thumbnail,(int)toTaskRect.left,(int)toTaskRect.top,(int)toTaskRect.width(),(int)toTaskRect.height(),mHandler,null);
    }
    return getUnknownTransitionActivityOptions();
  }
}

Fixed version (ground truth):
/** 
 * Creates the activity options for an app->recents transition.
 */
private ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo topTask,TaskStackView stackView){
  if (topTask.stackId == FREEFORM_WORKSPACE_STACK_ID) {
    ArrayList<AppTransitionAnimationSpec> specs=new ArrayList<>();
    ArrayList<Task> tasks=stackView.getStack().getStackTasks();
    TaskStackLayoutAlgorithm stackLayout=stackView.getStackAlgorithm();
    TaskStackViewScroller stackScroller=stackView.getScroller();
    stackView.updateLayoutAlgorithm(true);
    stackView.updateToInitialState();
    for (int i=tasks.size() - 1; i >= 0; i--) {
      Task task=tasks.get(i);
      if (task.isFreeformTask()) {
        mTmpTransform=stackLayout.getStackTransformScreenCoordinates(task,stackScroller.getStackScroll(),mTmpTransform,null);
        Rect toTaskRect=new Rect();
        mTmpTransform.rect.round(toTaskRect);
        Bitmap thumbnail=getThumbnailBitmap(topTask,task,mTmpTransform);
        specs.add(new AppTransitionAnimationSpec(task.key.id,thumbnail,toTaskRect));
      }
    }
    AppTransitionAnimationSpec[] specsArray=new AppTransitionAnimationSpec[specs.size()];
    specs.toArray(specsArray);
    return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,specsArray,mHandler,null,this);
  }
 else {
    Task toTask=new Task();
    TaskViewTransform toTransform=getThumbnailTransitionTransform(stackView,toTask);
    RectF toTaskRect=toTransform.rect;
    Bitmap thumbnail=getThumbnailBitmap(topTask,toTask,toTransform);
    if (thumbnail != null) {
      return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,thumbnail,(int)toTaskRect.left,(int)toTaskRect.top,(int)toTaskRect.width(),(int)toTaskRect.height(),mHandler,null);
    }
    return getUnknownTransitionActivityOptions();
  }
}