Program: 194707
Project: 194707
Buggy source:
/** 
 * Synchronizes the views with the model 
 */
boolean synchronizeStackViewsWithModel(){
  if (mStackViewsDirty) {
    RecentsTaskLoader loader=RecentsTaskLoader.getInstance();
    SystemServicesProxy ssp=loader.getSystemServicesProxy();
    ArrayList<Task> tasks=mStack.getTasks();
    float stackScroll=mStackScroller.getStackScroll();
    int[] visibleRange=mTmpVisibleRange;
    boolean isValidVisibleRange=updateStackTransforms(mCurrentTaskTransforms,tasks,stackScroll,visibleRange,false);
    if (mDebugOverlay != null) {
      mDebugOverlay.setText("String_Node_Str" + visibleRange[1] + "String_Node_Str"+ visibleRange[0]+ "String_Node_Str");
    }
    if (Constants.DebugFlags.App.EnableDismissAll && mDismissAllButton == null) {
      mDismissAllButton=(DismissView)mInflater.inflate(R.layout.recents_dismiss_button,this,false);
      mDismissAllButton.setOnButtonClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          mStack.removeAllTasks();
        }
      }
);
      addView(mDismissAllButton,0);
    }
    mTmpTaskViewMap.clear();
    List<TaskView> taskViews=getTaskViews();
    int taskViewCount=taskViews.size();
    for (int i=taskViewCount - 1; i >= 0; i--) {
      TaskView tv=taskViews.get(i);
      Task task=tv.getTask();
      int taskIndex=mStack.indexOfTask(task);
      if (visibleRange[1] <= taskIndex && taskIndex <= visibleRange[0]) {
        mTmpTaskViewMap.put(task,tv);
      }
 else {
        mViewPool.returnViewToPool(tv);
        if (task == mStack.getFrontMostTask()) {
          hideDismissAllButton(null);
        }
      }
    }
    for (int i=visibleRange[0]; isValidVisibleRange && i >= visibleRange[1]; i--) {
      Task task=tasks.get(i);
      TaskViewTransform transform=mCurrentTaskTransforms.get(i);
      TaskView tv=mTmpTaskViewMap.get(task);
      int taskIndex=mStack.indexOfTask(task);
      if (tv == null) {
        tv=mViewPool.pickUpViewFromPool(task,task);
        if (mLayersDisabled) {
          tv.disableLayersForOneFrame();
        }
        if (mStackViewsAnimationDuration > 0) {
          if (Float.compare(transform.p,0f) <= 0) {
            mLayoutAlgorithm.getStackTransform(0f,0f,mTmpTransform,null);
          }
 else {
            mLayoutAlgorithm.getStackTransform(1f,0f,mTmpTransform,null);
          }
          tv.updateViewPropertiesToTaskTransform(mTmpTransform,0);
        }
        if (!mAwaitingFirstLayout && (task == mStack.getFrontMostTask())) {
          showDismissAllButton();
        }
      }
      tv.updateViewPropertiesToTaskTransform(mCurrentTaskTransforms.get(taskIndex),mStackViewsAnimationDuration,mRequestUpdateClippingListener);
      taskViews=getTaskViews();
      taskViewCount=taskViews.size();
      if (taskViewCount > 0 && ssp.isTouchExplorationEnabled()) {
        TaskView atv=taskViews.get(taskViewCount - 1);
        int indexOfTask=mStack.indexOfTask(atv.getTask());
        if (mPrevAccessibilityFocusedIndex != indexOfTask) {
          tv.requestAccessibilityFocus();
          mPrevAccessibilityFocusedIndex=indexOfTask;
        }
      }
    }
    mStackViewsAnimationDuration=0;
    mStackViewsDirty=false;
    mStackViewsClipDirty=true;
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Synchronizes the views with the model 
 */
boolean synchronizeStackViewsWithModel(){
  if (mStackViewsDirty) {
    RecentsTaskLoader loader=RecentsTaskLoader.getInstance();
    SystemServicesProxy ssp=loader.getSystemServicesProxy();
    ArrayList<Task> tasks=mStack.getTasks();
    float stackScroll=mStackScroller.getStackScroll();
    int[] visibleRange=mTmpVisibleRange;
    boolean isValidVisibleRange=updateStackTransforms(mCurrentTaskTransforms,tasks,stackScroll,visibleRange,false);
    if (mDebugOverlay != null) {
      mDebugOverlay.setText("String_Node_Str" + visibleRange[1] + "String_Node_Str"+ visibleRange[0]+ "String_Node_Str");
    }
    if (Constants.DebugFlags.App.EnableDismissAll && mDismissAllButton == null) {
      mDismissAllButton=(DismissView)mInflater.inflate(R.layout.recents_dismiss_button,this,false);
      mDismissAllButton.setOnButtonClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          mStack.removeAllTasks();
        }
      }
);
      addView(mDismissAllButton,0);
    }
    mTmpTaskViewMap.clear();
    List<TaskView> taskViews=getTaskViews();
    int taskViewCount=taskViews.size();
    boolean reaquireAccessibilityFocus=false;
    for (int i=taskViewCount - 1; i >= 0; i--) {
      TaskView tv=taskViews.get(i);
      Task task=tv.getTask();
      int taskIndex=mStack.indexOfTask(task);
      if (visibleRange[1] <= taskIndex && taskIndex <= visibleRange[0]) {
        mTmpTaskViewMap.put(task,tv);
      }
 else {
        mViewPool.returnViewToPool(tv);
        reaquireAccessibilityFocus|=(i == mPrevAccessibilityFocusedIndex);
        if (task == mStack.getFrontMostTask()) {
          hideDismissAllButton(null);
        }
      }
    }
    for (int i=visibleRange[0]; isValidVisibleRange && i >= visibleRange[1]; i--) {
      Task task=tasks.get(i);
      TaskViewTransform transform=mCurrentTaskTransforms.get(i);
      TaskView tv=mTmpTaskViewMap.get(task);
      int taskIndex=mStack.indexOfTask(task);
      if (tv == null) {
        tv=mViewPool.pickUpViewFromPool(task,task);
        if (mLayersDisabled) {
          tv.disableLayersForOneFrame();
        }
        if (mStackViewsAnimationDuration > 0) {
          if (Float.compare(transform.p,0f) <= 0) {
            mLayoutAlgorithm.getStackTransform(0f,0f,mTmpTransform,null);
          }
 else {
            mLayoutAlgorithm.getStackTransform(1f,0f,mTmpTransform,null);
          }
          tv.updateViewPropertiesToTaskTransform(mTmpTransform,0);
        }
        if (!mAwaitingFirstLayout && (task == mStack.getFrontMostTask())) {
          showDismissAllButton();
        }
      }
      tv.updateViewPropertiesToTaskTransform(mCurrentTaskTransforms.get(taskIndex),mStackViewsAnimationDuration,mRequestUpdateClippingListener);
      if (reaquireAccessibilityFocus) {
        taskViews=getTaskViews();
        taskViewCount=taskViews.size();
        if (taskViewCount > 0 && ssp.isTouchExplorationEnabled() && mPrevAccessibilityFocusedIndex != -1) {
          TaskView atv=taskViews.get(taskViewCount - 1);
          int indexOfTask=mStack.indexOfTask(atv.getTask());
          if (mPrevAccessibilityFocusedIndex != indexOfTask) {
            tv.requestAccessibilityFocus();
            mPrevAccessibilityFocusedIndex=indexOfTask;
          }
        }
      }
    }
    mStackViewsAnimationDuration=0;
    mStackViewsDirty=false;
    mStackViewsClipDirty=true;
    return true;
  }
  return false;
}