Program: 157579
Project: 157579
Buggy source:
private void launchDictioanryOverriding(){
  AnyKeyboard currentKeyboard=mKeyboardSwitcher.getCurrentKeyboard();
  final String dictionaryOverridingKey=getDictionaryOverrideKey(currentKeyboard);
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.icon_8_key);
  builder.setTitle(getResources().getString(R.string.override_dictionary_title,currentKeyboard.getKeyboardName()));
  builder.setNegativeButton(android.R.string.cancel,null);
  ArrayList<CharSequence> dictioanries=new ArrayList<CharSequence>();
  dictioanries.add(getString(R.string.override_dictionary_default));
  for (  DictionaryBuilder dictionaryBuilder : ExternalDictionaryFactory.getAllCreators(this)) {
    dictioanries.add(this.getResources().getString(dictionaryBuilder.getDictionaryNameResId()));
  }
  final CharSequence[] items=new CharSequence[dictioanries.size()];
  dictioanries.toArray(items);
  builder.setItems(items,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface di,    int position){
      di.dismiss();
      Editor editor=getSharedPreferences().edit();
switch (position) {
case 0:
        Log.d("String_Node_Str","String_Node_Str");
      editor.remove(dictionaryOverridingKey);
    showToastMessage(R.string.override_disabled,true);
  break;
default :
if ((position < 0) || (position >= items.length)) {
  Log.d("String_Node_Str","String_Node_Str");
}
 else {
  String selectedLanguageString=items[position].toString();
  Log.d("String_Node_Str","String_Node_Str" + selectedLanguageString);
  editor.putString(dictionaryOverridingKey,selectedLanguageString);
  showToastMessage(getString(R.string.override_enabled,selectedLanguageString),true);
}
break;
}
editor.commit();
setMainDictionaryForCurrentKeyboard();
}
}
);
mOptionsDialog=builder.create();
Window window=mOptionsDialog.getWindow();
WindowManager.LayoutParams lp=window.getAttributes();
lp.token=mInputView.getWindowToken();
lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
mOptionsDialog.show();
}

Fixed version (ground truth):
private void launchDictioanryOverriding(){
  AnyKeyboard currentKeyboard=mKeyboardSwitcher.getCurrentKeyboard();
  final String dictionaryOverridingKey=getDictionaryOverrideKey(currentKeyboard);
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.icon_8_key);
  builder.setTitle(getResources().getString(R.string.override_dictionary_title,currentKeyboard.getKeyboardName()));
  builder.setNegativeButton(android.R.string.cancel,null);
  ArrayList<CharSequence> dictioanries=new ArrayList<CharSequence>();
  dictioanries.add(getString(R.string.override_dictionary_default));
  for (  DictionaryBuilder dictionaryBuilder : ExternalDictionaryFactory.getAllCreators(this)) {
    dictioanries.add(dictionaryBuilder.getDictionaryName());
  }
  final CharSequence[] items=new CharSequence[dictioanries.size()];
  dictioanries.toArray(items);
  builder.setItems(items,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface di,    int position){
      di.dismiss();
      Editor editor=getSharedPreferences().edit();
switch (position) {
case 0:
        Log.d("String_Node_Str","String_Node_Str");
      editor.remove(dictionaryOverridingKey);
    showToastMessage(R.string.override_disabled,true);
  break;
default :
if ((position < 0) || (position >= items.length)) {
  Log.d("String_Node_Str","String_Node_Str");
}
 else {
  String selectedLanguageString=items[position].toString();
  Log.d("String_Node_Str","String_Node_Str" + selectedLanguageString);
  editor.putString(dictionaryOverridingKey,selectedLanguageString);
  showToastMessage(getString(R.string.override_enabled,selectedLanguageString),true);
}
break;
}
editor.commit();
setMainDictionaryForCurrentKeyboard();
}
}
);
mOptionsDialog=builder.create();
Window window=mOptionsDialog.getWindow();
WindowManager.LayoutParams lp=window.getAttributes();
lp.token=mInputView.getWindowToken();
lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
mOptionsDialog.show();
}