Program: 199476
Project: 199476
Buggy source:
/** 
 * TaskStackView.TaskStackCallbacks Implementation 
 */
@Override public void onTaskLaunched(final TaskStackView stackView,final TaskView tv,final TaskStack stack,final Task task){
  if (mCb != null) {
    mCb.onTaskLaunching();
  }
  final Runnable launchRunnable=new Runnable(){
    @Override public void run(){
      TaskViewTransform transform;
      View sourceView=tv;
      int offsetX=0;
      int offsetY=0;
      if (tv == null) {
        RecentsConfiguration config=RecentsConfiguration.getInstance();
        sourceView=stackView;
        transform=stackView.getStackTransform(stack.indexOfTask(task));
        offsetX=transform.rect.left;
        offsetY=Math.min(transform.rect.top,config.displayRect.height());
      }
 else {
        transform=stackView.getStackTransform(stack.indexOfTask(task));
      }
      ActivityOptions opts=null;
      int thumbnailWidth=transform.rect.width();
      int thumbnailHeight=transform.rect.height();
      if (task.thumbnail != null && thumbnailWidth > 0 && thumbnailHeight > 0 && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
        Bitmap b=Bitmap.createBitmap(thumbnailWidth,thumbnailHeight,Bitmap.Config.ARGB_8888);
        Canvas c=new Canvas(b);
        c.drawBitmap(task.thumbnail,new Rect(0,0,task.thumbnail.getWidth(),task.thumbnail.getHeight()),new Rect(0,0,thumbnailWidth,thumbnailHeight),null);
        c.setBitmap(null);
        opts=ActivityOptions.makeThumbnailScaleUpAnimation(sourceView,b,offsetX,offsetY);
      }
      Intent i=new Intent(task.key.intent);
      i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
      try {
        if (opts != null) {
          getContext().startActivityAsUser(i,opts.toBundle(),UserHandle.CURRENT);
        }
 else {
          getContext().startActivityAsUser(i,UserHandle.CURRENT);
        }
      }
 catch (      ActivityNotFoundException anfe) {
        Console.logError(getContext(),"String_Node_Str");
      }
      Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey,"String_Node_Str");
    }
  }
;
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey,"String_Node_Str");
  if (tv == null || !Constants.Values.TaskView.AnimateFrontTaskIconOnLeavingRecents) {
    post(launchRunnable);
  }
 else {
    tv.animateOnLeavingRecents(launchRunnable);
  }
}

Fixed version (ground truth):
/** 
 * TaskStackView.TaskStackCallbacks Implementation 
 */
@Override public void onTaskLaunched(final TaskStackView stackView,final TaskView tv,final TaskStack stack,final Task task){
  if (mCb != null) {
    mCb.onTaskLaunching();
  }
  final Runnable launchRunnable=new Runnable(){
    @Override public void run(){
      TaskViewTransform transform;
      View sourceView=tv;
      int offsetX=0;
      int offsetY=0;
      if (tv == null) {
        RecentsConfiguration config=RecentsConfiguration.getInstance();
        sourceView=stackView;
        transform=stackView.getStackTransform(stack.indexOfTask(task));
        offsetX=transform.rect.left;
        offsetY=Math.min(transform.rect.top,config.displayRect.height());
      }
 else {
        transform=stackView.getStackTransform(stack.indexOfTask(task));
      }
      ActivityOptions opts=null;
      int thumbnailWidth=transform.rect.width();
      int thumbnailHeight=transform.rect.height();
      if (task.thumbnail != null && thumbnailWidth > 0 && thumbnailHeight > 0 && task.thumbnail.getWidth() > 0 && task.thumbnail.getHeight() > 0) {
        Bitmap b=Bitmap.createBitmap(thumbnailWidth,thumbnailHeight,Bitmap.Config.ARGB_8888);
        Canvas c=new Canvas(b);
        c.drawBitmap(task.thumbnail,new Rect(0,0,task.thumbnail.getWidth(),task.thumbnail.getHeight()),new Rect(0,0,thumbnailWidth,thumbnailHeight),null);
        c.setBitmap(null);
        opts=ActivityOptions.makeThumbnailScaleUpAnimation(sourceView,b,offsetX,offsetY);
      }
      if (task.isActive) {
        ActivityManager am=(ActivityManager)stackView.getContext().getSystemService(Context.ACTIVITY_SERVICE);
        if (opts != null) {
          am.moveTaskToFront(task.key.id,ActivityManager.MOVE_TASK_WITH_HOME,opts.toBundle());
        }
 else {
          am.moveTaskToFront(task.key.id,ActivityManager.MOVE_TASK_WITH_HOME);
        }
      }
 else {
        Intent i=new Intent(task.key.intent);
        i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
        try {
          if (opts != null) {
            getContext().startActivityAsUser(i,opts.toBundle(),UserHandle.CURRENT);
          }
 else {
            getContext().startActivityAsUser(i,UserHandle.CURRENT);
          }
        }
 catch (        ActivityNotFoundException anfe) {
          Console.logError(getContext(),"String_Node_Str");
        }
      }
      Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey,"String_Node_Str");
    }
  }
;
  Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,Constants.DebugFlags.App.TimeRecentsLaunchKey,"String_Node_Str");
  if (tv == null || !Constants.Values.TaskView.AnimateFrontTaskIconOnLeavingRecents) {
    post(launchRunnable);
  }
 else {
    tv.animateOnLeavingRecents(launchRunnable);
  }
}