Program: 193601
Project: 193601
Buggy source:
/** 
 * Starts the recents activity 
 */
void startRecentsActivity(ActivityManager.RunningTaskInfo topTask,boolean isTopTaskHome){
  RecentsTaskLoader loader=RecentsTaskLoader.getInstance();
  RecentsConfiguration.reinitialize(mContext,mSystemServicesProxy);
  if (sInstanceLoadPlan == null) {
    sInstanceLoadPlan=loader.createLoadPlan(mContext);
  }
  if (mConfig.multiWindowEnabled) {
    loader.preloadTasks(sInstanceLoadPlan,true);
    TaskStack stack=sInstanceLoadPlan.getTaskStack();
    mDummyStackView.updateMinMaxScrollForStack(stack,mTriggeredFromAltTab,true);
    TaskStackViewLayoutAlgorithm.VisibilityReport stackVr=mDummyStackView.computeStackVisibilityReport();
    ActivityOptions opts=getUnknownTransitionActivityOptions();
    startAlternateRecentsActivity(topTask,opts,true,false,false,stackVr);
    return;
  }
  if (!sInstanceLoadPlan.hasTasks()) {
    loader.preloadTasks(sInstanceLoadPlan,isTopTaskHome);
  }
  TaskStack stack=sInstanceLoadPlan.getTaskStack();
  mDummyStackView.updateMinMaxScrollForStack(stack,mTriggeredFromAltTab,isTopTaskHome);
  TaskStackViewLayoutAlgorithm.VisibilityReport stackVr=mDummyStackView.computeStackVisibilityReport();
  boolean hasRecentTasks=stack.getTaskCount() > 0;
  boolean useThumbnailTransition=(topTask != null) && !isTopTaskHome && hasRecentTasks;
  if (useThumbnailTransition) {
    ActivityOptions opts=getThumbnailTransitionActivityOptions(topTask,stack,mDummyStackView);
    if (opts != null) {
      startAlternateRecentsActivity(topTask,opts,false,false,true,stackVr);
    }
 else {
      useThumbnailTransition=false;
    }
  }
  if (!useThumbnailTransition) {
    if (hasRecentTasks) {
      String homeActivityPackage=mSystemServicesProxy.getHomeActivityPackageName();
      String searchWidgetPackage=Prefs.getString(mContext,Prefs.Key.SEARCH_APP_WIDGET_PACKAGE,null);
      boolean fromSearchHome=(homeActivityPackage != null) && homeActivityPackage.equals(searchWidgetPackage);
      ActivityOptions opts=getHomeTransitionActivityOptions(fromSearchHome);
      startAlternateRecentsActivity(topTask,opts,true,fromSearchHome,false,stackVr);
    }
 else {
      ActivityOptions opts=getUnknownTransitionActivityOptions();
      startAlternateRecentsActivity(topTask,opts,true,false,false,stackVr);
    }
  }
  mLastToggleTime=SystemClock.elapsedRealtime();
}

Fixed version (ground truth):
/** 
 * Starts the recents activity 
 */
void startRecentsActivity(ActivityManager.RunningTaskInfo topTask,boolean isTopTaskHome){
  RecentsTaskLoader loader=RecentsTaskLoader.getInstance();
  RecentsConfiguration config=RecentsConfiguration.getInstance();
  config.reinitializeWithApplicationContext(mContext,mSystemServicesProxy);
  if (sInstanceLoadPlan == null) {
    sInstanceLoadPlan=loader.createLoadPlan(mContext);
  }
  if (mConfig.multiWindowEnabled) {
    loader.preloadTasks(sInstanceLoadPlan,true);
    TaskStack stack=sInstanceLoadPlan.getTaskStack();
    mDummyStackView.updateMinMaxScrollForStack(stack,mTriggeredFromAltTab,true);
    TaskStackViewLayoutAlgorithm.VisibilityReport stackVr=mDummyStackView.computeStackVisibilityReport();
    ActivityOptions opts=getUnknownTransitionActivityOptions();
    startAlternateRecentsActivity(topTask,opts,true,false,false,stackVr);
    return;
  }
  if (!sInstanceLoadPlan.hasTasks()) {
    loader.preloadTasks(sInstanceLoadPlan,isTopTaskHome);
  }
  TaskStack stack=sInstanceLoadPlan.getTaskStack();
  mDummyStackView.updateMinMaxScrollForStack(stack,mTriggeredFromAltTab,isTopTaskHome);
  TaskStackViewLayoutAlgorithm.VisibilityReport stackVr=mDummyStackView.computeStackVisibilityReport();
  boolean hasRecentTasks=stack.getTaskCount() > 0;
  boolean useThumbnailTransition=(topTask != null) && !isTopTaskHome && hasRecentTasks;
  if (useThumbnailTransition) {
    ActivityOptions opts=getThumbnailTransitionActivityOptions(topTask,stack,mDummyStackView);
    if (opts != null) {
      startAlternateRecentsActivity(topTask,opts,false,false,true,stackVr);
    }
 else {
      useThumbnailTransition=false;
    }
  }
  if (!useThumbnailTransition) {
    if (hasRecentTasks) {
      String homeActivityPackage=mSystemServicesProxy.getHomeActivityPackageName();
      String searchWidgetPackage=Prefs.getString(mContext,Prefs.Key.SEARCH_APP_WIDGET_PACKAGE,null);
      boolean fromSearchHome=(homeActivityPackage != null) && homeActivityPackage.equals(searchWidgetPackage);
      ActivityOptions opts=getHomeTransitionActivityOptions(fromSearchHome);
      startAlternateRecentsActivity(topTask,opts,true,fromSearchHome,false,stackVr);
    }
 else {
      ActivityOptions opts=getUnknownTransitionActivityOptions();
      startAlternateRecentsActivity(topTask,opts,true,false,false,stackVr);
    }
  }
  mLastToggleTime=SystemClock.elapsedRealtime();
}