Program: 86968
Project: 86968
Buggy source:
/** 
 * Called when a drawer has settled in a completely closed state. 
 */
public void onDrawerClosed(View view){
  super.onDrawerClosed(view);
  if (position == prevPosition) {
    if (mTitle != null) {
      setTitle(mTitle);
    }
    return;
  }
switch (listAdapter.getItemViewType(position)) {
case NavigationDrawerListAdapter.ITEM_TYPE_PROFILE:
    listAdapter.setSelectedProfileIndex(listAdapter.getItemArrayIndex(position));
  break;
case NavigationDrawerListAdapter.ITEM_TYPE_NEW_PROFILE:
break;
case NavigationDrawerListAdapter.ITEM_TYPE_MAIN:
FragmentManager fragmentManager=getFragmentManager();
FragmentTransaction ft;
boolean isValid=true;
int itemArrayIndex=listAdapter.getItemArrayIndex(position);
switch (itemArrayIndex) {
case INDEX_MANAGE_ENVIRONMENTS:
ft=fragmentManager.beginTransaction();
ft.setCustomAnimations(R.animator.fade_in,R.animator.fade_out);
ft.replace(R.id.container,new ManageEnvironmentFragment()).commit();
break;
case INDEX_ENVIRONMENT_OVERLAP:
ft=fragmentManager.beginTransaction();
ft.setCustomAnimations(R.animator.fade_in,R.animator.fade_out);
ft.replace(R.id.container,new OverlappingEnvironmentsFragment()).commit();
break;
case INDEX_MASTER_PASSWORD:
ft=fragmentManager.beginTransaction();
ft.setCustomAnimations(R.animator.fade_in,R.animator.fade_out);
ft.replace(R.id.container,new SetMasterPasswordFragment()).commit();
break;
default :
isValid=false;
}
if (isValid) {
mTitle=mainItemList.get(itemArrayIndex);
listAdapter.setSelectedMainItemIndex(itemArrayIndex);
listAdapter.notifyDataSetChanged();
}
if (position != -1) {
prevPosition=position;
position=-1;
}
break;
case NavigationDrawerListAdapter.ITEM_TYPE_SECONDARY:
switch (listAdapter.getItemArrayIndex(position)) {
case INDEX_SETTINGS:
startActivity(new Intent(SmartLockScreenSettings.this,GeneralSettingsActivity.class));
break;
default :
Toast.makeText(SmartLockScreenSettings.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
}
break;
default :
return;
}
if (mTitle != null) {
setTitle(mTitle);
}
}

Fixed version (ground truth):
/** 
 * Called when a drawer has settled in a completely closed state. 
 */
public void onDrawerClosed(View view){
  super.onDrawerClosed(view);
  if (position == prevPosition) {
    if (mTitle != null) {
      setTitle(mTitle);
    }
    return;
  }
switch (listAdapter.getItemViewType(position)) {
case NavigationDrawerListAdapter.ITEM_TYPE_PROFILE:
    listAdapter.setSelectedProfileIndex(listAdapter.getItemArrayIndex(position));
  break;
case NavigationDrawerListAdapter.ITEM_TYPE_NEW_PROFILE:
break;
case NavigationDrawerListAdapter.ITEM_TYPE_MAIN:
FragmentManager fragmentManager=getFragmentManager();
FragmentTransaction ft;
boolean isValid=true;
int itemArrayIndex=listAdapter.getItemArrayIndex(position);
switch (itemArrayIndex) {
case INDEX_MANAGE_ENVIRONMENTS:
ft=fragmentManager.beginTransaction();
ft.setCustomAnimations(R.animator.fade_in,R.animator.fade_out);
ft.replace(R.id.container,new ManageEnvironmentFragment()).commit();
break;
case INDEX_ENVIRONMENT_OVERLAP:
ft=fragmentManager.beginTransaction();
ft.setCustomAnimations(R.animator.fade_in,R.animator.fade_out);
ft.replace(R.id.container,new OverlappingEnvironmentsFragment()).commit();
break;
case INDEX_MASTER_PASSWORD:
ft=fragmentManager.beginTransaction();
ft.setCustomAnimations(R.animator.fade_in,R.animator.fade_out);
ft.replace(R.id.container,new SetMasterPasswordFragment()).commit();
break;
default :
isValid=false;
}
if (isValid) {
mTitle=mainItemList.get(itemArrayIndex);
listAdapter.setSelectedMainItemIndex(itemArrayIndex);
listAdapter.notifyDataSetChanged();
}
if (position != -1) {
prevPosition=position;
}
break;
case NavigationDrawerListAdapter.ITEM_TYPE_SECONDARY:
switch (listAdapter.getItemArrayIndex(position)) {
case INDEX_SETTINGS:
startActivity(new Intent(SmartLockScreenSettings.this,GeneralSettingsActivity.class));
break;
default :
Toast.makeText(SmartLockScreenSettings.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
}
break;
default :
return;
}
if (mTitle != null) {
setTitle(mTitle);
}
position=-1;
}