Program: 88232
Project: 88232
Buggy source:
@Override public void onStartInputView(EditorInfo attribute,boolean restarting){
  final KeyboardSwitcher switcher=mKeyboardSwitcher;
  LatinKeyboardView inputView=switcher.getInputView();
  if (inputView == null) {
    return;
  }
  SubtypeSwitcher.getInstance().updateParametersOnStartInputView();
  if (mRefreshKeyboardRequired) {
    mRefreshKeyboardRequired=false;
    onKeyboardLanguageChanged();
  }
  TextEntryState.newSession(this);
  int variation=attribute.inputType & EditorInfo.TYPE_MASK_VARIATION;
  mVoiceConnector.resetVoiceStates(isPasswordVariation(variation));
  mInputTypeNoAutoCorrect=false;
  mPredictionOn=false;
  mCompletionOn=false;
  mCompletions=null;
  mEnteredText=null;
  final int mode;
switch (attribute.inputType & EditorInfo.TYPE_MASK_CLASS) {
case EditorInfo.TYPE_CLASS_NUMBER:
case EditorInfo.TYPE_CLASS_DATETIME:
    mode=KeyboardSwitcher.MODE_NUMBER;
  break;
case EditorInfo.TYPE_CLASS_PHONE:
mode=KeyboardSwitcher.MODE_PHONE;
break;
case EditorInfo.TYPE_CLASS_TEXT:
mPredictionOn=true;
if (isPasswordVariation(variation)) {
mPredictionOn=false;
}
if (isEmailVariation(variation) || variation == EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME) {
mAutoSpace=false;
}
 else {
mAutoSpace=true;
}
if (isEmailVariation(variation)) {
mPredictionOn=false;
mode=KeyboardSwitcher.MODE_EMAIL;
}
 else if (variation == EditorInfo.TYPE_TEXT_VARIATION_URI) {
mPredictionOn=false;
mode=KeyboardSwitcher.MODE_URL;
}
 else if (variation == EditorInfo.TYPE_TEXT_VARIATION_SHORT_MESSAGE) {
mode=KeyboardSwitcher.MODE_IM;
}
 else if (variation == EditorInfo.TYPE_TEXT_VARIATION_FILTER) {
mPredictionOn=false;
mode=KeyboardSwitcher.MODE_TEXT;
}
 else if (variation == EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) {
mode=KeyboardSwitcher.MODE_WEB;
if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) == 0) {
mInputTypeNoAutoCorrect=true;
}
}
 else {
mode=KeyboardSwitcher.MODE_TEXT;
}
if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS) != 0) {
mPredictionOn=false;
mInputTypeNoAutoCorrect=true;
}
if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) == 0 && (attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) == 0) {
mInputTypeNoAutoCorrect=true;
}
if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
mPredictionOn=false;
mCompletionOn=isFullscreenMode();
}
break;
default :
mode=KeyboardSwitcher.MODE_TEXT;
break;
}
inputView.closing();
mComposing.setLength(0);
mPredicting=false;
mDeleteCount=0;
mJustAddedAutoSpace=false;
loadSettings(attribute);
switcher.loadKeyboard(mode,attribute.imeOptions,mVoiceConnector.isVoiceButtonEnabled(),mVoiceConnector.isVoiceButtonOnPrimary());
switcher.updateShiftState();
setCandidatesViewShownInternal(isCandidateStripVisible(),false);
updateSuggestions();
mHasDictionary=mSuggest.hasMainDictionary();
updateCorrectionMode();
inputView.setPreviewEnabled(mPopupOn);
inputView.setProximityCorrectionEnabled(true);
mPredictionOn=mPredictionOn && (mCorrectionMode > 0 || isSuggestionShown());
checkReCorrectionOnStart();
checkTutorial(attribute.privateImeOptions);
inputView.setForeground(true);
mVoiceConnector.onStartInputView();
if (TRACE) Debug.startMethodTracing("String_Node_Str");
}

Fixed version (ground truth):
@Override public void onStartInputView(EditorInfo attribute,boolean restarting){
  final KeyboardSwitcher switcher=mKeyboardSwitcher;
  LatinKeyboardView inputView=switcher.getInputView();
  if (inputView == null) {
    return;
  }
  SubtypeSwitcher.getInstance().updateParametersOnStartInputView();
  if (mRefreshKeyboardRequired) {
    mRefreshKeyboardRequired=false;
    onKeyboardLanguageChanged();
  }
  TextEntryState.newSession(this);
  int variation=attribute.inputType & EditorInfo.TYPE_MASK_VARIATION;
  mVoiceConnector.resetVoiceStates(isPasswordVariation(variation));
  mInputTypeNoAutoCorrect=false;
  mPredictionOn=false;
  mCompletionOn=false;
  mCompletions=null;
  mEnteredText=null;
  final int mode;
switch (attribute.inputType & EditorInfo.TYPE_MASK_CLASS) {
case EditorInfo.TYPE_CLASS_NUMBER:
case EditorInfo.TYPE_CLASS_DATETIME:
    mode=KeyboardSwitcher.MODE_NUMBER;
  break;
case EditorInfo.TYPE_CLASS_PHONE:
mode=KeyboardSwitcher.MODE_PHONE;
break;
case EditorInfo.TYPE_CLASS_TEXT:
mPredictionOn=true;
if (isPasswordVariation(variation)) {
mPredictionOn=false;
}
if (isEmailVariation(variation) || variation == EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME) {
mAutoSpace=false;
}
 else {
mAutoSpace=true;
}
if (isEmailVariation(variation)) {
mPredictionOn=false;
mode=KeyboardSwitcher.MODE_EMAIL;
}
 else if (variation == EditorInfo.TYPE_TEXT_VARIATION_URI) {
mPredictionOn=false;
mode=KeyboardSwitcher.MODE_URL;
}
 else if (variation == EditorInfo.TYPE_TEXT_VARIATION_SHORT_MESSAGE) {
mode=KeyboardSwitcher.MODE_IM;
}
 else if (variation == EditorInfo.TYPE_TEXT_VARIATION_FILTER) {
mPredictionOn=false;
mode=KeyboardSwitcher.MODE_TEXT;
}
 else if (variation == EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) {
mode=KeyboardSwitcher.MODE_WEB;
if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) == 0) {
mInputTypeNoAutoCorrect=true;
}
}
 else {
mode=KeyboardSwitcher.MODE_TEXT;
}
if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS) != 0) {
mPredictionOn=false;
mInputTypeNoAutoCorrect=true;
}
if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) == 0 && (attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) == 0) {
mInputTypeNoAutoCorrect=true;
}
if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
mPredictionOn=false;
mCompletionOn=isFullscreenMode();
}
break;
default :
mode=KeyboardSwitcher.MODE_TEXT;
break;
}
inputView.closing();
mComposing.setLength(0);
mPredicting=false;
mDeleteCount=0;
mJustAddedAutoSpace=false;
loadSettings(attribute);
switcher.loadKeyboard(mode,attribute.imeOptions,mVoiceConnector.isVoiceButtonEnabled(),mVoiceConnector.isVoiceButtonOnPrimary());
switcher.updateShiftState();
setCandidatesViewShownInternal(isCandidateStripVisible(),false);
updateSuggestions();
mHasDictionary=mSuggest.hasMainDictionary();
updateCorrectionMode();
inputView.setPreviewEnabled(mPopupOn);
inputView.setProximityCorrectionEnabled(true);
mPredictionOn=mPredictionOn && (mCorrectionMode > 0 || isSuggestionShown());
checkReCorrectionOnStart();
checkTutorial(attribute.privateImeOptions);
inputView.setForeground(true);
mVoiceConnector.onStartInputView(mKeyboardSwitcher.getInputView().getWindowToken());
if (TRACE) Debug.startMethodTracing("String_Node_Str");
}