Program: 195664
Project: 195664
Buggy source:
/** 
 * TaskStackView.TaskStackCallbacks Implementation 
 */
@Override public void onTaskViewClicked(final TaskStackView stackView,final TaskView tv,final TaskStack stack,final Task task,final boolean lockToTask){
  if (mCb != null) {
    mCb.onTaskViewClicked();
  }
  TaskViewTransform transform=new TaskViewTransform();
  View sourceView;
  int offsetX=0;
  int offsetY=0;
  float stackScroll=stackView.getScroller().getStackScroll();
  if (tv == null) {
    sourceView=stackView;
    transform=stackView.getStackAlgorithm().getStackTransform(task,stackScroll,transform,null);
    offsetX=transform.rect.left;
    offsetY=mConfig.displayRect.height();
  }
 else {
    sourceView=tv.mThumbnailView;
    transform=stackView.getStackAlgorithm().getStackTransform(task,stackScroll,transform,null);
  }
  final SystemServicesProxy ssp=RecentsTaskLoader.getInstance().getSystemServicesProxy();
  ActivityOptions opts=null;
  if (task.thumbnail != null && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
    Bitmap b;
    if (tv != null) {
      if (tv.isFocusedTask()) {
        tv.unsetFocusedTask();
      }
      float scale=tv.getScaleX();
      int fromHeaderWidth=(int)(tv.mHeaderView.getMeasuredWidth() * scale);
      int fromHeaderHeight=(int)(tv.mHeaderView.getMeasuredHeight() * scale);
      b=Bitmap.createBitmap(fromHeaderWidth,fromHeaderHeight,Bitmap.Config.ARGB_8888);
      if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) {
        b.eraseColor(0xFFff0000);
      }
 else {
        Canvas c=new Canvas(b);
        c.scale(tv.getScaleX(),tv.getScaleY());
        tv.mHeaderView.draw(c);
        c.setBitmap(null);
      }
    }
 else {
      b=Bitmap.createBitmap(1,1,Bitmap.Config.ALPHA_8);
    }
    ActivityOptions.OnAnimationStartedListener animStartedListener=null;
    if (lockToTask) {
      animStartedListener=new ActivityOptions.OnAnimationStartedListener(){
        boolean mTriggered=false;
        @Override public void onAnimationStarted(){
          if (!mTriggered) {
            postDelayed(new Runnable(){
              @Override public void run(){
                mCb.onScreenPinningRequest();
              }
            }
,350);
            mTriggered=true;
          }
        }
      }
;
    }
    opts=ActivityOptions.makeThumbnailAspectScaleUpAnimation(sourceView,b,offsetX,offsetY,transform.rect.width(),transform.rect.height(),animStartedListener);
  }
  final ActivityOptions launchOpts=opts;
  final Runnable launchRunnable=new Runnable(){
    @Override public void run(){
      if (task.isActive) {
        ssp.moveTaskToFront(task.key.id,launchOpts);
      }
 else {
        if (ssp.startActivityFromRecents(getContext(),task.key.id,task.activityLabel,launchOpts)) {
          if (launchOpts == null && lockToTask) {
            mCb.onScreenPinningRequest();
          }
        }
 else {
          onTaskViewDismissed(task);
          if (mCb != null) {
            mCb.onTaskLaunchFailed();
          }
        }
      }
    }
  }
;
  if (tv == null) {
    launchRunnable.run();
  }
 else {
    if (!task.group.isFrontMostTask(task)) {
      stackView.startLaunchTaskAnimation(tv,launchRunnable,lockToTask);
    }
 else {
      stackView.startLaunchTaskAnimation(tv,null,lockToTask);
      launchRunnable.run();
    }
  }
}

Fixed version (ground truth):
/** 
 * TaskStackView.TaskStackCallbacks Implementation 
 */
@Override public void onTaskViewClicked(final TaskStackView stackView,final TaskView tv,final TaskStack stack,final Task task,final boolean lockToTask){
  if (mCb != null) {
    mCb.onTaskViewClicked();
  }
  TaskViewTransform transform=new TaskViewTransform();
  View sourceView;
  int offsetX=0;
  int offsetY=0;
  float stackScroll=stackView.getScroller().getStackScroll();
  if (tv == null) {
    sourceView=stackView;
    transform=stackView.getStackAlgorithm().getStackTransform(task,stackScroll,transform,null);
    offsetX=transform.rect.left;
    offsetY=mConfig.displayRect.height();
  }
 else {
    sourceView=tv.mThumbnailView;
    transform=stackView.getStackAlgorithm().getStackTransform(task,stackScroll,transform,null);
  }
  final SystemServicesProxy ssp=RecentsTaskLoader.getInstance().getSystemServicesProxy();
  ActivityOptions opts=null;
  if (task.thumbnail != null && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
    Bitmap b;
    if (tv != null) {
      if (tv.isFocusedTask()) {
        tv.unsetFocusedTask();
      }
      float scale=tv.getScaleX();
      int fromHeaderWidth=(int)(tv.mHeaderView.getMeasuredWidth() * scale);
      int fromHeaderHeight=(int)(tv.mHeaderView.getMeasuredHeight() * scale);
      b=Bitmap.createBitmap(fromHeaderWidth,fromHeaderHeight,Bitmap.Config.ARGB_8888);
      if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) {
        b.eraseColor(0xFFff0000);
      }
 else {
        Canvas c=new Canvas(b);
        c.scale(tv.getScaleX(),tv.getScaleY());
        tv.mHeaderView.draw(c);
        c.setBitmap(null);
      }
    }
 else {
      b=Bitmap.createBitmap(1,1,Bitmap.Config.ALPHA_8);
    }
    ActivityOptions.OnAnimationStartedListener animStartedListener=null;
    if (lockToTask) {
      animStartedListener=new ActivityOptions.OnAnimationStartedListener(){
        boolean mTriggered=false;
        @Override public void onAnimationStarted(){
          if (!mTriggered) {
            postDelayed(new Runnable(){
              @Override public void run(){
                mCb.onScreenPinningRequest();
              }
            }
,350);
            mTriggered=true;
          }
        }
      }
;
    }
    opts=ActivityOptions.makeThumbnailAspectScaleUpAnimation(sourceView,b,offsetX,offsetY,transform.rect.width(),transform.rect.height(),sourceView.getHandler(),animStartedListener);
  }
  final ActivityOptions launchOpts=opts;
  final Runnable launchRunnable=new Runnable(){
    @Override public void run(){
      if (task.isActive) {
        ssp.moveTaskToFront(task.key.id,launchOpts);
      }
 else {
        if (ssp.startActivityFromRecents(getContext(),task.key.id,task.activityLabel,launchOpts)) {
          if (launchOpts == null && lockToTask) {
            mCb.onScreenPinningRequest();
          }
        }
 else {
          onTaskViewDismissed(task);
          if (mCb != null) {
            mCb.onTaskLaunchFailed();
          }
        }
      }
    }
  }
;
  if (tv == null) {
    launchRunnable.run();
  }
 else {
    if (!task.group.isFrontMostTask(task)) {
      stackView.startLaunchTaskAnimation(tv,launchRunnable,lockToTask);
    }
 else {
      stackView.startLaunchTaskAnimation(tv,null,lockToTask);
      launchRunnable.run();
    }
  }
}