Program: 52640
Project: 52640
Buggy source:
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public void setupSearch(Menu menu){
  if (Build.VERSION.SDK_INT < 11) {
    return;
  }
  mSearchItem=menu.findItem(R.id.search);
  MenuItemCompat.setOnActionExpandListener(mSearchItem,new OnActionExpandListener(){
    @Override public boolean onMenuItemActionExpand(    MenuItem item){
      return mCurrentPageId == R.id.task_group_search;
    }
    @Override public boolean onMenuItemActionCollapse(    MenuItem item){
      if (mPreviousPagePosition >= 0 && mCurrentPageId == R.id.task_group_search) {
        mViewPager.setCurrentItem(mPreviousPagePosition);
        mCurrentPageId=mPagerAdapter.getPageId(mPreviousPagePosition);
      }
      return mPreviousPagePosition >= 0 || mCurrentPageId != R.id.task_group_search;
    }
  }
);
  SearchView searchView=(SearchView)MenuItemCompat.getActionView(mSearchItem);
  SearchManager searchManager=(SearchManager)getSystemService(Context.SEARCH_SERVICE);
  if (null != searchManager) {
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
  }
  searchView.setQueryHint(getString(R.string.menu_search_hint));
  searchView.setIconified(true);
  searchView.setOnQueryTextListener(new OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      mSearchHistoryHelper.commitSearch();
      mHandler.post(mSearchUpdater);
      return true;
    }
    @Override public boolean onQueryTextChange(    String query){
      mHandler.removeCallbacks(mSearchUpdater);
      if (query.length() > 0) {
        mSearchHistoryHelper.updateSearch(query);
        mHandler.postDelayed(mSearchUpdater,SEARCH_UPDATE_DELAY);
      }
 else {
        mSearchHistoryHelper.removeCurrentSearch();
        mHandler.post(mSearchUpdater);
      }
      return true;
    }
  }
);
  if (mAutoExpandSearchView) {
    mSearchItem.expandActionView();
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public void setupSearch(Menu menu){
  if (Build.VERSION.SDK_INT < 11) {
    return;
  }
  mSearchItem=menu.findItem(R.id.search);
  MenuItemCompat.setOnActionExpandListener(mSearchItem,new OnActionExpandListener(){
    @Override public boolean onMenuItemActionExpand(    MenuItem item){
      return mCurrentPageId == R.id.task_group_search;
    }
    @Override public boolean onMenuItemActionCollapse(    MenuItem item){
      if (mPreviousPagePosition >= 0 && mCurrentPageId == R.id.task_group_search) {
        mViewPager.setCurrentItem(mPreviousPagePosition);
        mCurrentPageId=mPagerAdapter.getPageId(mPreviousPagePosition);
      }
      return mPreviousPagePosition >= 0 || mCurrentPageId != R.id.task_group_search;
    }
  }
);
  SearchView searchView=(SearchView)MenuItemCompat.getActionView(mSearchItem);
  SearchManager searchManager=(SearchManager)getSystemService(Context.SEARCH_SERVICE);
  if (null != searchManager) {
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
  }
  searchView.setQueryHint(getString(R.string.menu_search_hint));
  searchView.setIconified(true);
  searchView.setOnQueryTextListener(new OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      mSearchHistoryHelper.commitSearch();
      mHandler.post(mSearchUpdater);
      return true;
    }
    @Override public boolean onQueryTextChange(    String query){
      if (mCurrentPageId != R.id.task_group_search) {
        return true;
      }
      mHandler.removeCallbacks(mSearchUpdater);
      if (query.length() > 0) {
        mSearchHistoryHelper.updateSearch(query);
        mHandler.postDelayed(mSearchUpdater,SEARCH_UPDATE_DELAY);
      }
 else {
        mSearchHistoryHelper.removeCurrentSearch();
        mHandler.post(mSearchUpdater);
      }
      return true;
    }
  }
);
  if (mAutoExpandSearchView) {
    mSearchItem.expandActionView();
  }
}