Program: 191638
Project: 191638
Buggy source:
/** 
 * Transitions to the next recent task in the stack.
 */
public void showNextTask(){
  SystemServicesProxy ssp=Recents.getSystemServices();
  RecentsTaskLoader loader=Recents.getTaskLoader();
  RecentsTaskLoadPlan plan=loader.createLoadPlan(mContext);
  loader.preloadTasks(plan,-1,true);
  TaskStack focusedStack=plan.getTaskStack();
  if (focusedStack == null || focusedStack.getTaskCount() == 0)   return;
  ActivityManager.RunningTaskInfo runningTask=ssp.getRunningTask();
  if (runningTask == null)   return;
  boolean isRunningTaskInHomeStack=SystemServicesProxy.isHomeStack(runningTask.stackId);
  ArrayList<Task> tasks=focusedStack.getStackTasks();
  Task toTask=null;
  ActivityOptions launchOpts=null;
  int taskCount=tasks.size();
  for (int i=taskCount - 1; i >= 1; i--) {
    Task task=tasks.get(i);
    if (isRunningTaskInHomeStack) {
      toTask=tasks.get(i - 1);
      launchOpts=ActivityOptions.makeCustomAnimation(mContext,R.anim.recents_launch_next_affiliated_task_target,R.anim.recents_fast_toggle_app_home_exit);
      break;
    }
 else     if (task.key.id == runningTask.id) {
      toTask=tasks.get(i - 1);
      launchOpts=ActivityOptions.makeCustomAnimation(mContext,R.anim.recents_launch_prev_affiliated_task_target,R.anim.recents_launch_prev_affiliated_task_source);
      break;
    }
  }
  if (toTask == null) {
    ssp.startInPlaceAnimationOnFrontMostApplication(ActivityOptions.makeCustomInPlaceAnimation(mContext,R.anim.recents_launch_prev_affiliated_task_bounce));
    return;
  }
  ssp.startActivityFromRecents(mContext,toTask.key,toTask.title,launchOpts);
}

Fixed version (ground truth):
/** 
 * Transitions to the next recent task in the stack.
 */
public void showNextTask(){
  SystemServicesProxy ssp=Recents.getSystemServices();
  RecentsTaskLoader loader=Recents.getTaskLoader();
  RecentsTaskLoadPlan plan=loader.createLoadPlan(mContext);
  loader.preloadTasks(plan,-1,false);
  TaskStack focusedStack=plan.getTaskStack();
  if (focusedStack == null || focusedStack.getTaskCount() == 0)   return;
  ActivityManager.RunningTaskInfo runningTask=ssp.getRunningTask();
  if (runningTask == null)   return;
  boolean isRunningTaskInHomeStack=SystemServicesProxy.isHomeStack(runningTask.stackId);
  ArrayList<Task> tasks=focusedStack.getStackTasks();
  Task toTask=null;
  ActivityOptions launchOpts=null;
  int taskCount=tasks.size();
  for (int i=taskCount - 1; i >= 1; i--) {
    Task task=tasks.get(i);
    if (isRunningTaskInHomeStack) {
      toTask=tasks.get(i - 1);
      launchOpts=ActivityOptions.makeCustomAnimation(mContext,R.anim.recents_launch_next_affiliated_task_target,R.anim.recents_fast_toggle_app_home_exit);
      break;
    }
 else     if (task.key.id == runningTask.id) {
      toTask=tasks.get(i - 1);
      launchOpts=ActivityOptions.makeCustomAnimation(mContext,R.anim.recents_launch_prev_affiliated_task_target,R.anim.recents_launch_prev_affiliated_task_source);
      break;
    }
  }
  if (toTask == null) {
    ssp.startInPlaceAnimationOnFrontMostApplication(ActivityOptions.makeCustomInPlaceAnimation(mContext,R.anim.recents_launch_prev_affiliated_task_bounce));
    return;
  }
  ssp.startActivityFromRecents(mContext,toTask.key,toTask.title,launchOpts);
}