Program: 86946
Project: 86946
Buggy source:
private void setUpNavDrawer(){
  mainItemList=new ArrayList<String>();
  mainItemList.add(INDEX_MANAGE_ENVIRONMENTS,getString(R.string.title_activity_manage_environment));
  mainItemList.add(INDEX_ENVIRONMENT_OVERLAP,getString(R.string.title_activity_environment_overlap));
  mainItemList.add(INDEX_MASTER_PASSWORD,getString(R.string.title_activity_set_master_password));
  mainItemRIds=new ArrayList<Integer>();
  mainItemRIds.add(INDEX_MANAGE_ENVIRONMENTS,R.drawable.ic_environment);
  mainItemRIds.add(INDEX_ENVIRONMENT_OVERLAP,R.drawable.ic_env_overlap);
  mainItemRIds.add(INDEX_MASTER_PASSWORD,R.drawable.ic_master_password);
  restrictedMainItemList=new ArrayList<String>();
  restrictedMainItemList.add(INDEX_ALLOWED_APPS,getString(R.string.title_activity_allowed_apps));
  restrictedMainItemList.add(INDEX_PASSWORD,getString(R.string.title_activity_set_passphrase));
  restrictedMainItemRIds=new ArrayList<Integer>();
  restrictedMainItemRIds.add(INDEX_ALLOWED_APPS,R.drawable.ic_apps);
  restrictedMainItemRIds.add(INDEX_PASSWORD,R.drawable.ic_master_password);
  secondaryItemList=new ArrayList<String>();
  secondaryItemList.add(INDEX_SETTINGS,getString(R.string.title_activity_general_settings));
  secondaryItemList.add(INDEX_HELP,getString(R.string.title_activity_help));
  secondaryItemList.add(INDEX_ABOUT,getString(R.string.title_activity_about));
  secondaryItemIds=new ArrayList<Integer>();
  secondaryItemIds.add(INDEX_SETTINGS,R.drawable.ic_settings);
  secondaryItemIds.add(INDEX_HELP,R.drawable.ic_help);
  secondaryItemIds.add(INDEX_ABOUT,R.drawable.ic_about);
  listAdapter=new NavigationDrawerListAdapter(this,mainItemList,mainItemRIds,secondaryItemList,secondaryItemIds);
  RelativeLayout navDrawerLayout=(RelativeLayout)findViewById(R.id.linear_layout_nav_drawer);
  final LinearLayout currentUserLinearLayout=(LinearLayout)navDrawerLayout.findViewById(R.id.linear_layout_current_user);
  currentUserLinearLayout.bringToFront();
  navDrawerLayout.requestLayout();
  navDrawerLayout.invalidate();
  currentUserPicture=(ImageView)currentUserLinearLayout.findViewById(R.id.user_image_view);
  currentUserName=(TextView)currentUserLinearLayout.findViewById(R.id.user_name_text_view);
  currentUserDescription=(TextView)currentUserLinearLayout.findViewById(R.id.user_type_text_view);
  userListDropDown=(ImageView)currentUserLinearLayout.findViewById(R.id.user_selected_tick_image_view);
  currentUserLinearLayout.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (isInUserList) {
        hideUserList();
      }
 else {
        showUserList();
      }
      isInUserList=!isInUserList;
    }
  }
);
  navDrawerListView=(ListView)navDrawerLayout.findViewById(R.id.drawer_list_view);
  usersList=(ListView)navDrawerLayout.findViewById(R.id.list_view_user_profiles);
  refreshUserList();
  usersList.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      mSelectedUserIndex=position;
      setCurrentUserView();
      if (position == mDeviceOwnerIndex) {
        onDeviceOwnerSelected();
      }
 else {
        onRestrictedProfileSelected();
      }
      currentUserLinearLayout.callOnClick();
    }
  }
);
switch (getResources().getConfiguration().orientation) {
case Configuration.ORIENTATION_UNDEFINED:
case Configuration.ORIENTATION_PORTRAIT:
    View footerView=new View(this);
  footerView.setLayoutParams(new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,mPaddingBottom));
footerView.setBackgroundColor(Color.TRANSPARENT);
navDrawerListView.addFooterView(footerView,null,false);
break;
}
navDrawerLayout.setPadding(navDrawerLayout.getPaddingLeft(),navDrawerLayout.getPaddingTop() + mPaddingTop,navDrawerLayout.getPaddingRight(),navDrawerLayout.getPaddingBottom());
navDrawerListView.setAdapter(listAdapter);
navDrawerListView.setSelection(0);
navDrawerListView.setOnItemClickListener(new DrawerItemClickListener());
listAdapter.setSelectedMainItemIndex(0);
mTitle=mainItemList.get(0);
position=prevPosition=navDrawerListView.getSelectedItemPosition();
}

Fixed version (ground truth):
private void setUpNavDrawer(){
  mainItemList=new ArrayList<String>();
  mainItemList.add(INDEX_MANAGE_ENVIRONMENTS,getString(R.string.title_activity_manage_environment));
  mainItemList.add(INDEX_ENVIRONMENT_OVERLAP,getString(R.string.title_activity_environment_overlap));
  mainItemList.add(INDEX_MASTER_PASSWORD,getString(R.string.title_activity_set_master_password));
  mainItemRIds=new ArrayList<Integer>();
  mainItemRIds.add(INDEX_MANAGE_ENVIRONMENTS,R.drawable.ic_environment);
  mainItemRIds.add(INDEX_ENVIRONMENT_OVERLAP,R.drawable.ic_env_overlap);
  mainItemRIds.add(INDEX_MASTER_PASSWORD,R.drawable.ic_master_password);
  restrictedMainItemList=new ArrayList<String>();
  restrictedMainItemList.add(INDEX_ALLOWED_APPS,getString(R.string.title_activity_allowed_apps));
  restrictedMainItemList.add(INDEX_PASSWORD,getString(R.string.title_activity_set_passphrase));
  restrictedMainItemRIds=new ArrayList<Integer>();
  restrictedMainItemRIds.add(INDEX_ALLOWED_APPS,R.drawable.ic_apps);
  restrictedMainItemRIds.add(INDEX_PASSWORD,R.drawable.ic_master_password);
  secondaryItemList=new ArrayList<String>();
  secondaryItemList.add(INDEX_SETTINGS,getString(R.string.title_activity_general_settings));
  secondaryItemList.add(INDEX_HELP,getString(R.string.title_activity_help));
  secondaryItemList.add(INDEX_ABOUT,getString(R.string.title_activity_about));
  secondaryItemIds=new ArrayList<Integer>();
  secondaryItemIds.add(INDEX_SETTINGS,R.drawable.ic_settings);
  secondaryItemIds.add(INDEX_HELP,R.drawable.ic_help);
  secondaryItemIds.add(INDEX_ABOUT,R.drawable.ic_about);
  listAdapter=new NavigationDrawerListAdapter(this,mainItemList,mainItemRIds,secondaryItemList,secondaryItemIds);
  RelativeLayout navDrawerLayout=(RelativeLayout)findViewById(R.id.linear_layout_nav_drawer);
  final LinearLayout currentUserLinearLayout=(LinearLayout)navDrawerLayout.findViewById(R.id.linear_layout_current_user);
  currentUserLinearLayout.bringToFront();
  navDrawerLayout.requestLayout();
  navDrawerLayout.invalidate();
  currentUserPicture=(ImageView)currentUserLinearLayout.findViewById(R.id.user_image_view);
  currentUserName=(TextView)currentUserLinearLayout.findViewById(R.id.user_name_text_view);
  currentUserName.setTypeface(Typeface.DEFAULT_BOLD);
  currentUserDescription=(TextView)currentUserLinearLayout.findViewById(R.id.user_type_text_view);
  userListDropDown=(ImageView)currentUserLinearLayout.findViewById(R.id.user_selected_tick_image_view);
  currentUserLinearLayout.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (isInUserList) {
        hideUserList();
      }
 else {
        showUserList();
      }
      isInUserList=!isInUserList;
    }
  }
);
  navDrawerListView=(ListView)navDrawerLayout.findViewById(R.id.drawer_list_view);
  usersList=(ListView)navDrawerLayout.findViewById(R.id.list_view_user_profiles);
  refreshUserList();
  usersList.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      mSelectedUserIndex=position;
      setCurrentUserView();
      if (position == mDeviceOwnerIndex) {
        onDeviceOwnerSelected();
      }
 else {
        onRestrictedProfileSelected();
      }
      currentUserLinearLayout.callOnClick();
    }
  }
);
switch (getResources().getConfiguration().orientation) {
case Configuration.ORIENTATION_UNDEFINED:
case Configuration.ORIENTATION_PORTRAIT:
    View footerView=new View(this);
  footerView.setLayoutParams(new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,mPaddingBottom));
footerView.setBackgroundColor(Color.TRANSPARENT);
navDrawerListView.addFooterView(footerView,null,false);
break;
}
navDrawerLayout.setPadding(navDrawerLayout.getPaddingLeft(),navDrawerLayout.getPaddingTop() + mPaddingTop,navDrawerLayout.getPaddingRight(),navDrawerLayout.getPaddingBottom());
navDrawerListView.setAdapter(listAdapter);
navDrawerListView.setSelection(0);
navDrawerListView.setOnItemClickListener(new DrawerItemClickListener());
listAdapter.setSelectedMainItemIndex(0);
mTitle=mainItemList.get(0);
position=prevPosition=navDrawerListView.getSelectedItemPosition();
}