Program: 193102
Project: 193102
Buggy source:
/** 
 * Prepares the header bar layout for the next transition, if the task view bounds has changed since the last call, it will attempt to re-measure and layout the header bar to the new size.
 * @param tryAndBindSearchWidget if set, will attempt to fetch and bind the search widget if oneis not already bound (can be expensive)
 * @param stack the stack to initialize the stack layout with
 */
private void reloadHeaderBarLayout(boolean tryAndBindSearchWidget,TaskStack stack){
  RecentsConfiguration config=Recents.getConfiguration();
  SystemServicesProxy ssp=Recents.getSystemServices();
  Rect windowRect=ssp.getWindowRect();
  config.update(windowRect);
  if (!RecentsDebugFlags.Static.DisableSearchBar && tryAndBindSearchWidget) {
    if (ssp.getOrBindSearchAppWidget(mContext,mAppWidgetHost) != null) {
      config.getSearchBarBounds(windowRect,mStatusBarHeight,mSearchBarBounds);
    }
  }
  Rect systemInsets=new Rect(0,mStatusBarHeight,(config.hasTransposedNavBar ? mNavBarWidth : 0),(config.hasTransposedNavBar ? 0 : mNavBarHeight));
  config.getTaskStackBounds(windowRect,systemInsets.top,systemInsets.right,mSearchBarBounds,mTaskStackBounds);
  TaskStackLayoutAlgorithm algo=mDummyStackView.getStackAlgorithm();
  Rect taskStackBounds=new Rect(mTaskStackBounds);
  algo.setSystemInsets(systemInsets);
  if (stack != null) {
    algo.initialize(taskStackBounds,TaskStackLayoutAlgorithm.StackState.getStackStateForStack(stack));
  }
  Rect taskViewBounds=algo.getUntransformedTaskViewBounds();
  if (!taskViewBounds.equals(mLastTaskViewBounds)) {
    mLastTaskViewBounds.set(taskViewBounds);
    int taskViewWidth=taskViewBounds.width();
synchronized (mHeaderBarLock) {
      mHeaderBar.measure(View.MeasureSpec.makeMeasureSpec(taskViewWidth,View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mTaskBarHeight,View.MeasureSpec.EXACTLY));
      mHeaderBar.layout(0,0,taskViewWidth,mTaskBarHeight);
    }
  }
}

Fixed version (ground truth):
/** 
 * Prepares the header bar layout for the next transition, if the task view bounds has changed since the last call, it will attempt to re-measure and layout the header bar to the new size.
 * @param tryAndBindSearchWidget if set, will attempt to fetch and bind the search widget if oneis not already bound (can be expensive)
 * @param stack the stack to initialize the stack layout with
 */
private void reloadHeaderBarLayout(boolean tryAndBindSearchWidget,TaskStack stack){
  RecentsConfiguration config=Recents.getConfiguration();
  SystemServicesProxy ssp=Recents.getSystemServices();
  Rect windowRect=ssp.getWindowRect();
  config.update(windowRect);
  if (RecentsDebugFlags.Static.EnableSearchBar && tryAndBindSearchWidget) {
    if (ssp.getOrBindSearchAppWidget(mContext,mAppWidgetHost) != null) {
      config.getSearchBarBounds(windowRect,mStatusBarHeight,mSearchBarBounds);
    }
  }
  Rect systemInsets=new Rect(0,mStatusBarHeight,(config.hasTransposedNavBar ? mNavBarWidth : 0),(config.hasTransposedNavBar ? 0 : mNavBarHeight));
  config.getTaskStackBounds(windowRect,systemInsets.top,systemInsets.right,mSearchBarBounds,mTaskStackBounds);
  TaskStackLayoutAlgorithm algo=mDummyStackView.getStackAlgorithm();
  Rect taskStackBounds=new Rect(mTaskStackBounds);
  algo.setSystemInsets(systemInsets);
  if (stack != null) {
    algo.initialize(taskStackBounds,TaskStackLayoutAlgorithm.StackState.getStackStateForStack(stack));
  }
  Rect taskViewBounds=algo.getUntransformedTaskViewBounds();
  if (!taskViewBounds.equals(mLastTaskViewBounds)) {
    mLastTaskViewBounds.set(taskViewBounds);
    int taskViewWidth=taskViewBounds.width();
synchronized (mHeaderBarLock) {
      mHeaderBar.measure(View.MeasureSpec.makeMeasureSpec(taskViewWidth,View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mTaskBarHeight,View.MeasureSpec.EXACTLY));
      mHeaderBar.layout(0,0,taskViewWidth,mTaskBarHeight);
    }
  }
}