nus-yam/ex-repair huggingface dataset:
Program: 88226
Project: 88226
Buggy source:
private void loadSettings(EditorInfo attribute){
  final SharedPreferences prefs=mPrefs;
  Vibrator vibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
  mVibrateOn=vibrator != null && vibrator.hasVibrator() && prefs.getBoolean(Settings.PREF_VIBRATE_ON,false);
  mSoundOn=prefs.getBoolean(Settings.PREF_SOUND_ON,false);
  mPopupOn=isPopupEnabled(prefs);
  mAutoCap=prefs.getBoolean(Settings.PREF_AUTO_CAP,true);
  mQuickFixes=isQuickFixesEnabled(prefs);
  mAutoCorrectEnabled=isAutoCorrectEnabled(prefs);
  mBigramSuggestionEnabled=mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs);
  loadAndSetAutoCorrectionThreshold(prefs);
  mVoiceConnector.loadSettings(attribute,prefs);
  updateCorrectionMode();
  updateAutoTextEnabled();
  updateSuggestionVisibility(prefs);
  SubtypeSwitcher.getInstance().loadSettings();
}

Fixed version (ground truth):
private void loadSettings(EditorInfo attribute){
  final SharedPreferences prefs=mPrefs;
  Vibrator vibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
  mVibrateOn=vibrator != null && vibrator.hasVibrator() && prefs.getBoolean(Settings.PREF_VIBRATE_ON,false);
  mSoundOn=prefs.getBoolean(Settings.PREF_SOUND_ON,true);
  mPopupOn=isPopupEnabled(prefs);
  mAutoCap=prefs.getBoolean(Settings.PREF_AUTO_CAP,true);
  mQuickFixes=isQuickFixesEnabled(prefs);
  mAutoCorrectEnabled=isAutoCorrectEnabled(prefs);
  mBigramSuggestionEnabled=mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs);
  loadAndSetAutoCorrectionThreshold(prefs);
  mVoiceConnector.loadSettings(attribute,prefs);
  updateCorrectionMode();
  updateAutoTextEnabled();
  updateSuggestionVisibility(prefs);
  SubtypeSwitcher.getInstance().loadSettings();
}
Program: 88228
Project: 88228
Buggy source:
private void onDownEventInternal(int x,int y,long eventTime){
  int keyIndex=mKeyState.onDownKey(x,y,eventTime);
  mIsAllowedSlidingKeyInput=mConfigSlidingKeyInputEnabled || isModifierInternal(keyIndex) || mKeyDetector instanceof MiniKeyboardKeyDetector;
  mKeyAlreadyProcessed=false;
  mIsRepeatableKey=false;
  mIsInSlidingKeyInput=false;
  if (isValidKeyIndex(keyIndex)) {
    callListenerOnPress(mKeys[keyIndex].mCode);
    keyIndex=mKeyState.getKeyIndex();
  }
  if (isValidKeyIndex(keyIndex)) {
    if (mKeys[keyIndex].mRepeatable) {
      repeatKey(keyIndex);
      mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart,keyIndex,this);
      mIsRepeatableKey=true;
    }
    startLongPressTimer(keyIndex);
  }
  showKeyPreviewAndUpdateKeyGraphics(keyIndex);
}

Fixed version (ground truth):
private void onDownEventInternal(int x,int y,long eventTime){
  int keyIndex=mKeyState.onDownKey(x,y,eventTime);
  mIsAllowedSlidingKeyInput=mConfigSlidingKeyInputEnabled || isModifierInternal(keyIndex) || mKeyDetector instanceof MiniKeyboardKeyDetector;
  mKeyboardLayoutHasBeenChanged=false;
  mKeyAlreadyProcessed=false;
  mIsRepeatableKey=false;
  mIsInSlidingKeyInput=false;
  if (isValidKeyIndex(keyIndex)) {
    if (callListenerOnPressAndCheckKeyboardLayoutChange(mKeys[keyIndex].mCode))     keyIndex=mKeyState.onDownKey(x,y,eventTime);
  }
  if (isValidKeyIndex(keyIndex)) {
    if (mKeys[keyIndex].mRepeatable) {
      repeatKey(keyIndex);
      mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart,keyIndex,this);
      mIsRepeatableKey=true;
    }
    startLongPressTimer(keyIndex);
  }
  showKeyPreviewAndUpdateKeyGraphics(keyIndex);
}
Program: 88229
Project: 88229
Buggy source:
public void setKeyboard(Keyboard keyboard,Key[] keys,float keyHysteresisDistance){
  if (keyboard == null || keys == null || keyHysteresisDistance < 0)   throw new IllegalArgumentException();
  mKeyboard=keyboard;
  mKeys=keys;
  mKeyHysteresisDistanceSquared=(int)(keyHysteresisDistance * keyHysteresisDistance);
  mKeyState.onSetKeyboard();
}

Fixed version (ground truth):
public void setKeyboard(Keyboard keyboard,Key[] keys,float keyHysteresisDistance){
  if (keyboard == null || keys == null || keyHysteresisDistance < 0)   throw new IllegalArgumentException();
  mKeyboard=keyboard;
  mKeys=keys;
  mKeyHysteresisDistanceSquared=(int)(keyHysteresisDistance * keyHysteresisDistance);
  mKeyboardLayoutHasBeenChanged=true;
}
Program: 88230
Project: 88230
Buggy source:
private void checkReCorrectionOnStart(){
  if (mReCorrectionEnabled && isSuggestionShown() && isPredictionOn()) {
    InputConnection ic=getCurrentInputConnection();
    if (ic == null)     return;
    ExtractedTextRequest etr=new ExtractedTextRequest();
    etr.token=0;
    ExtractedText et=ic.getExtractedText(etr,0);
    if (et == null)     return;
    mLastSelectionStart=et.startOffset + et.selectionStart;
    mLastSelectionEnd=et.startOffset + et.selectionEnd;
    if (!TextUtils.isEmpty(et.text) && isCursorTouchingWord()) {
      mHandler.postUpdateOldSuggestions();
    }
  }
}

Fixed version (ground truth):
private void checkReCorrectionOnStart(){
  if (!mReCorrectionEnabled)   return;
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.finishComposingText();
  if (isSuggestionShown() && isPredictionOn()) {
    ExtractedTextRequest etr=new ExtractedTextRequest();
    etr.token=0;
    ExtractedText et=ic.getExtractedText(etr,0);
    if (et == null)     return;
    mLastSelectionStart=et.startOffset + et.selectionStart;
    mLastSelectionEnd=et.startOffset + et.selectionEnd;
    if (!TextUtils.isEmpty(et.text) && isCursorTouchingWord()) {
      mHandler.postUpdateOldSuggestions();
    }
  }
}
Program: 88231
Project: 88231
Buggy source:
private void checkReCorrectionOnStart(){
  if (mReCorrectionEnabled && isSuggestionShown() && isPredictionOn()) {
    InputConnection ic=getCurrentInputConnection();
    if (ic == null)     return;
    ExtractedTextRequest etr=new ExtractedTextRequest();
    etr.token=0;
    ExtractedText et=ic.getExtractedText(etr,0);
    if (et == null)     return;
    mLastSelectionStart=et.startOffset + et.selectionStart;
    mLastSelectionEnd=et.startOffset + et.selectionEnd;
    if (!TextUtils.isEmpty(et.text) && isCursorTouchingWord()) {
      mHandler.postUpdateOldSuggestions();
    }
  }
}

Fixed version (ground truth):
private void checkReCorrectionOnStart(){
  if (!mReCorrectionEnabled)   return;
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.finishComposingText();
  if (isSuggestionShown() && isPredictionOn()) {
    ExtractedTextRequest etr=new ExtractedTextRequest();
    etr.token=0;
    ExtractedText et=ic.getExtractedText(etr,0);
    if (et == null)     return;
    mLastSelectionStart=et.startOffset + et.selectionStart;
    mLastSelectionEnd=et.startOffset + et.selectionEnd;
    if (!TextUtils.isEmpty(et.text) && isCursorTouchingWord()) {
      mHandler.postUpdateOldSuggestions();
    }
  }
}
Program: 88233
Project: 88233
Buggy source:
public boolean setVoiceInput(VoiceInput vi){
  if (mVoiceInput == null) {
    mService.onKeyboardLanguageChanged();
    mVoiceInput=vi;
    if (isVoiceMode() && mVoiceInput != null) {
      if (DBG) {
        Log.d(TAG,"String_Node_Str");
      }
      mService.onKey(LatinKeyboardView.KEYCODE_VOICE,null,0,0);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean setVoiceInput(VoiceInput vi){
  if (mVoiceInput == null && vi != null) {
    mService.onKeyboardLanguageChanged();
    mVoiceInput=vi;
    if (isVoiceMode()) {
      if (DBG) {
        Log.d(TAG,"String_Node_Str");
      }
      mService.onKey(LatinKeyboardView.KEYCODE_VOICE,null,0,0);
      return true;
    }
  }
  return false;
}
Program: 88234
Project: 88234
Buggy source:
public void updateSubtype(InputMethodSubtype newSubtype){
  final String newLocale;
  final String newMode;
  if (newSubtype == null) {
    Log.e(TAG,"String_Node_Str");
    newLocale="String_Node_Str";
    newMode=KEYBOARD_MODE;
  }
 else {
    newLocale=newSubtype.getLocale();
    newMode=newSubtype.getMode();
  }
  if (DBG) {
    Log.w(TAG,"String_Node_Str" + newLocale + "String_Node_Str"+ newMode+ "String_Node_Str"+ mInputLocaleStr+ "String_Node_Str"+ mMode);
  }
  boolean languageChanged=false;
  if (!newLocale.equals(mInputLocaleStr)) {
    if (mInputLocaleStr != null) {
      languageChanged=true;
    }
    updateInputLocale(newLocale);
  }
  boolean modeChanged=false;
  String oldMode=mMode;
  if (!newMode.equals(mMode)) {
    if (mMode != null) {
      modeChanged=true;
    }
    mMode=newMode;
  }
  if (isKeyboardMode()) {
    if (modeChanged) {
      if (VOICE_MODE.equals(oldMode) && mVoiceInput != null) {
        mVoiceInput.cancel();
      }
    }
    if (languageChanged) {
      mService.onKeyboardLanguageChanged();
    }
  }
 else   if (isVoiceMode()) {
    if (languageChanged || modeChanged) {
      if (mVoiceInput != null) {
        mService.onKey(LatinKeyboardView.KEYCODE_VOICE,null,0,0);
      }
    }
  }
 else {
    Log.w(TAG,"String_Node_Str" + mMode);
  }
}

Fixed version (ground truth):
public void updateSubtype(InputMethodSubtype newSubtype){
  final String newLocale;
  final String newMode;
  if (newSubtype == null) {
    Log.e(TAG,"String_Node_Str");
    newLocale="String_Node_Str";
    newMode=KEYBOARD_MODE;
  }
 else {
    newLocale=newSubtype.getLocale();
    newMode=newSubtype.getMode();
  }
  if (DBG) {
    Log.w(TAG,"String_Node_Str" + newLocale + "String_Node_Str"+ newMode+ "String_Node_Str"+ mInputLocaleStr+ "String_Node_Str"+ mMode);
  }
  boolean languageChanged=false;
  if (!newLocale.equals(mInputLocaleStr)) {
    if (mInputLocaleStr != null) {
      languageChanged=true;
    }
    updateInputLocale(newLocale);
  }
  boolean modeChanged=false;
  String oldMode=mMode;
  if (!newMode.equals(mMode)) {
    if (mMode != null) {
      modeChanged=true;
    }
    mMode=newMode;
  }
  if (isKeyboardMode()) {
    if (modeChanged) {
      if (VOICE_MODE.equals(oldMode) && mVoiceInput != null) {
        mVoiceInput.cancel();
      }
    }
    if (languageChanged) {
      mService.onKeyboardLanguageChanged();
    }
  }
 else   if (isVoiceMode()) {
    if (languageChanged || modeChanged || VoiceIMEConnector.getInstance().needsToShowWarningDialog()) {
      if (mVoiceInput != null) {
        mService.onKey(LatinKeyboardView.KEYCODE_VOICE,null,0,0);
      }
    }
  }
 else {
    Log.w(TAG,"String_Node_Str" + mMode);
  }
}
Program: 88235
Project: 88235
Buggy source:
public void onClick(DialogInterface dialog,int whichButton){
  mVoiceInput.logKeyboardWarningDialogCancel();
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int whichButton){
  mVoiceInput.logKeyboardWarningDialogCancel();
  switchToLastInputMethod();
}
Program: 88236
Project: 88236
Buggy source:
public void startListening(final boolean swipe,IBinder token,final boolean configurationChanging){
  if (VOICE_INSTALLED) {
    if (!mHasUsedVoiceInput || (!mLocaleSupportedForVoiceInput && !mHasUsedVoiceInputUnsupportedLocale)) {
      showVoiceWarningDialog(swipe,token,configurationChanging);
    }
 else {
      reallyStartListening(swipe,configurationChanging);
    }
  }
}

Fixed version (ground truth):
public void startListening(final boolean swipe,IBinder token,final boolean configurationChanging){
  if (VOICE_INSTALLED) {
    if (needsToShowWarningDialog()) {
      showVoiceWarningDialog(swipe,token,configurationChanging);
    }
 else {
      reallyStartListening(swipe,configurationChanging);
    }
  }
}
Program: 88238
Project: 88238
Buggy source:
@Override public void onCancelVoice(){
  if (mRecognizing) {
    if (mSubtypeSwitcher.isVoiceMode()) {
      IBinder token=mContext.getWindow().getWindow().getAttributes().token;
      mImm.switchToLastInputMethod(token);
    }
 else     if (mSubtypeSwitcher.isKeyboardMode()) {
      mRecognizing=false;
      mContext.switchToKeyboardView();
    }
  }
}

Fixed version (ground truth):
@Override public void onCancelVoice(){
  if (mRecognizing) {
    if (mSubtypeSwitcher.isVoiceMode()) {
      switchToLastInputMethod();
    }
 else     if (mSubtypeSwitcher.isKeyboardMode()) {
      mRecognizing=false;
      mContext.switchToKeyboardView();
    }
  }
}
Program: 88239
Project: 88239
Buggy source:
public void onStartInputView(){
  mSubtypeSwitcher.setVoiceInput(mVoiceInput);
}

Fixed version (ground truth):
public void onStartInputView(IBinder token){
  if (mSubtypeSwitcher.isVoiceMode() && needsToShowWarningDialog() && token != null) {
    showVoiceWarningDialog(false,token,false);
  }
}
Program: 88240
Project: 88240
Buggy source:
private void reallyStartListening(boolean swipe,final boolean configurationChanging){
  if (!mHasUsedVoiceInput) {
    SharedPreferences.Editor editor=PreferenceManager.getDefaultSharedPreferences(mContext).edit();
    editor.putBoolean(PREF_HAS_USED_VOICE_INPUT,true);
    SharedPreferencesCompat.apply(editor);
    mHasUsedVoiceInput=true;
  }
  if (!mLocaleSupportedForVoiceInput && !mHasUsedVoiceInputUnsupportedLocale) {
    SharedPreferences.Editor editor=PreferenceManager.getDefaultSharedPreferences(mContext).edit();
    editor.putBoolean(PREF_HAS_USED_VOICE_INPUT_UNSUPPORTED_LOCALE,true);
    SharedPreferencesCompat.apply(editor);
    mHasUsedVoiceInputUnsupportedLocale=true;
  }
  mContext.clearSuggestions();
  FieldContext context=makeFieldContext();
  mVoiceInput.startListening(context,swipe);
  switchToRecognitionStatusView(configurationChanging);
}

Fixed version (ground truth):
private void reallyStartListening(boolean swipe,final boolean configurationChanging){
  if (!VOICE_INSTALLED) {
    return;
  }
  if (!mHasUsedVoiceInput) {
    SharedPreferences.Editor editor=PreferenceManager.getDefaultSharedPreferences(mContext).edit();
    editor.putBoolean(PREF_HAS_USED_VOICE_INPUT,true);
    SharedPreferencesCompat.apply(editor);
    mHasUsedVoiceInput=true;
  }
  if (!mLocaleSupportedForVoiceInput && !mHasUsedVoiceInputUnsupportedLocale) {
    SharedPreferences.Editor editor=PreferenceManager.getDefaultSharedPreferences(mContext).edit();
    editor.putBoolean(PREF_HAS_USED_VOICE_INPUT_UNSUPPORTED_LOCALE,true);
    SharedPreferencesCompat.apply(editor);
    mHasUsedVoiceInputUnsupportedLocale=true;
  }
  mContext.clearSuggestions();
  FieldContext context=makeFieldContext();
  mVoiceInput.startListening(context,swipe);
  switchToRecognitionStatusView(configurationChanging);
}
Program: 88241
Project: 88241
Buggy source:
public void onDownEvent(int x,int y,long eventTime){
  if (DEBUG)   debugLog("String_Node_Str",x,y);
  int keyIndex=mKeyState.onDownKey(x,y,eventTime);
  mKeyAlreadyProcessed=false;
  mIsRepeatableKey=false;
  checkMultiTap(eventTime,keyIndex);
  if (mListener != null) {
    int primaryCode=isValidKeyIndex(keyIndex) ? mKeys[keyIndex].codes[0] : 0;
    mListener.onPress(primaryCode);
    keyIndex=mKeyState.getKeyIndex();
  }
  if (isValidKeyIndex(keyIndex)) {
    if (mKeys[keyIndex].repeatable) {
      repeatKey(keyIndex);
      mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart,keyIndex,this);
      mIsRepeatableKey=true;
    }
    mHandler.startLongPressTimer(mLongPressKeyTimeout,keyIndex,this);
  }
  showKeyPreviewAndUpdateKey(keyIndex);
}

Fixed version (ground truth):
public void onDownEvent(int x,int y,long eventTime){
  if (DEBUG)   debugLog("String_Node_Str",x,y);
  int keyIndex=mKeyState.onDownKey(x,y,eventTime);
  mKeyAlreadyProcessed=false;
  mIsRepeatableKey=false;
  checkMultiTap(eventTime,keyIndex);
  if (mListener != null) {
    if (isValidKeyIndex(keyIndex)) {
      mListener.onPress(mKeys[keyIndex].codes[0]);
      keyIndex=mKeyState.getKeyIndex();
    }
  }
  if (isValidKeyIndex(keyIndex)) {
    if (mKeys[keyIndex].repeatable) {
      repeatKey(keyIndex);
      mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart,keyIndex,this);
      mIsRepeatableKey=true;
    }
    mHandler.startLongPressTimer(mLongPressKeyTimeout,keyIndex,this);
  }
  showKeyPreviewAndUpdateKey(keyIndex);
}
Program: 88242
Project: 88242
Buggy source:
public void onDownEvent(int x,int y,long eventTime){
  if (DEBUG)   debugLog("String_Node_Str",x,y);
  int keyIndex=mKeyState.onDownKey(x,y,eventTime);
  mKeyAlreadyProcessed=false;
  mIsRepeatableKey=false;
  checkMultiTap(eventTime,keyIndex);
  if (mListener != null) {
    int primaryCode=isValidKeyIndex(keyIndex) ? mKeys[keyIndex].codes[0] : 0;
    mListener.onPress(primaryCode);
    keyIndex=mKeyState.getKeyIndex();
  }
  if (isValidKeyIndex(keyIndex)) {
    if (mKeys[keyIndex].repeatable) {
      repeatKey(keyIndex);
      mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart,keyIndex,this);
      mIsRepeatableKey=true;
    }
    startLongPressTimer(keyIndex);
  }
  showKeyPreviewAndUpdateKeyGraphics(keyIndex);
}

Fixed version (ground truth):
public void onDownEvent(int x,int y,long eventTime){
  if (DEBUG)   debugLog("String_Node_Str",x,y);
  int keyIndex=mKeyState.onDownKey(x,y,eventTime);
  mKeyAlreadyProcessed=false;
  mIsRepeatableKey=false;
  checkMultiTap(eventTime,keyIndex);
  if (mListener != null) {
    if (isValidKeyIndex(keyIndex)) {
      mListener.onPress(mKeys[keyIndex].codes[0]);
      keyIndex=mKeyState.getKeyIndex();
    }
  }
  if (isValidKeyIndex(keyIndex)) {
    if (mKeys[keyIndex].repeatable) {
      repeatKey(keyIndex);
      mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart,keyIndex,this);
      mIsRepeatableKey=true;
    }
    startLongPressTimer(keyIndex);
  }
  showKeyPreviewAndUpdateKeyGraphics(keyIndex);
}
Program: 88243
Project: 88243
Buggy source:
public void onDownEvent(int x,int y,long eventTime){
  if (DEBUG)   debugLog("String_Node_Str",x,y);
  int keyIndex=mKeyState.onDownKey(x,y,eventTime);
  mKeyAlreadyProcessed=false;
  mIsRepeatableKey=false;
  checkMultiTap(eventTime,keyIndex);
  if (mListener != null) {
    int primaryCode=isValidKeyIndex(keyIndex) ? mKeys[keyIndex].codes[0] : 0;
    mListener.onPress(primaryCode);
    keyIndex=mKeyState.getKeyIndex();
  }
  if (isValidKeyIndex(keyIndex)) {
    if (mKeys[keyIndex].repeatable) {
      repeatKey(keyIndex);
      mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart,keyIndex,this);
      mIsRepeatableKey=true;
    }
    mHandler.startLongPressTimer(mLongPressKeyTimeout,keyIndex,this);
  }
  showKeyPreviewAndUpdateKey(keyIndex);
}

Fixed version (ground truth):
public void onDownEvent(int x,int y,long eventTime){
  if (DEBUG)   debugLog("String_Node_Str",x,y);
  int keyIndex=mKeyState.onDownKey(x,y,eventTime);
  mKeyAlreadyProcessed=false;
  mIsRepeatableKey=false;
  checkMultiTap(eventTime,keyIndex);
  if (mListener != null) {
    if (isValidKeyIndex(keyIndex)) {
      mListener.onPress(mKeys[keyIndex].codes[0]);
      keyIndex=mKeyState.getKeyIndex();
    }
  }
  if (isValidKeyIndex(keyIndex)) {
    if (mKeys[keyIndex].repeatable) {
      repeatKey(keyIndex);
      mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart,keyIndex,this);
      mIsRepeatableKey=true;
    }
    mHandler.startLongPressTimer(mLongPressKeyTimeout,keyIndex,this);
  }
  showKeyPreviewAndUpdateKey(keyIndex);
}
Program: 88244
Project: 88244
Buggy source:
private boolean openPopupIfRequired(int keyIndex,PointerTracker tracker){
  if (mPopupLayout == 0) {
    return false;
  }
  Key popupKey=tracker.getKey(keyIndex);
  if (popupKey == null)   return false;
  boolean result=onLongPress(popupKey);
  if (result) {
    dismissKeyPreview();
    tracker.setAlreadyProcessed();
    mMiniKeyboardTrackerId=tracker.mPointerId;
  }
  return result;
}

Fixed version (ground truth):
private boolean openPopupIfRequired(int keyIndex,PointerTracker tracker){
  if (mPopupLayout == 0) {
    return false;
  }
  Key popupKey=tracker.getKey(keyIndex);
  if (popupKey == null)   return false;
  boolean result=onLongPress(popupKey);
  if (result) {
    dismissKeyPreview();
    mMiniKeyboardTrackerId=tracker.mPointerId;
    tracker.setAlreadyProcessed();
    mPointerQueue.remove(tracker);
  }
  return result;
}
Program: 88245
Project: 88245
Buggy source:
private boolean openPopupIfRequired(int keyIndex,PointerTracker tracker){
  if (mPopupLayout == 0) {
    return false;
  }
  Key popupKey=tracker.getKey(keyIndex);
  if (popupKey == null)   return false;
  boolean result=onLongPress(popupKey);
  if (result) {
    dismissKeyPreview();
    tracker.setAlreadyProcessed();
    mMiniKeyboardTrackerId=tracker.mPointerId;
  }
  return result;
}

Fixed version (ground truth):
private boolean openPopupIfRequired(int keyIndex,PointerTracker tracker){
  if (mPopupLayout == 0) {
    return false;
  }
  Key popupKey=tracker.getKey(keyIndex);
  if (popupKey == null)   return false;
  boolean result=onLongPress(popupKey);
  if (result) {
    dismissKeyPreview();
    mMiniKeyboardTrackerId=tracker.mPointerId;
    tracker.setAlreadyProcessed();
    mPointerQueue.remove(tracker);
  }
  return result;
}
Program: 88246
Project: 88246
Buggy source:
private boolean openPopupIfRequired(int keyIndex,PointerTracker tracker){
  if (mPopupLayout == 0) {
    return false;
  }
  Key popupKey=tracker.getKey(keyIndex);
  if (popupKey == null)   return false;
  boolean result=onLongPress(popupKey);
  if (result) {
    dismissKeyPreview();
    tracker.setAlreadyProcessed();
    mMiniKeyboardTrackerId=tracker.mPointerId;
  }
  return result;
}

Fixed version (ground truth):
private boolean openPopupIfRequired(int keyIndex,PointerTracker tracker){
  if (mPopupLayout == 0) {
    return false;
  }
  Key popupKey=tracker.getKey(keyIndex);
  if (popupKey == null)   return false;
  boolean result=onLongPress(popupKey);
  if (result) {
    dismissKeyPreview();
    mMiniKeyboardTrackerId=tracker.mPointerId;
    tracker.setAlreadyProcessed();
    mPointerQueue.remove(tracker);
  }
  return result;
}
Program: 88247
Project: 88247
Buggy source:
void setKeyboardMode(int mode,int imeOptions,boolean enableVoice,boolean isSymbols){
  if (mInputView == null)   return;
  mMode=mode;
  mImeOptions=imeOptions;
  if (enableVoice != mHasVoice) {
    setVoiceMode(mHasVoice,mVoiceOnPrimary);
  }
  mIsSymbols=isSymbols;
  mInputView.setPreviewEnabled(mInputMethodService.getPopupOn());
  KeyboardId id=getKeyboardId(mode,imeOptions,isSymbols);
  LatinKeyboard keyboard=null;
  keyboard=getKeyboard(id);
  if (mode == MODE_PHONE) {
    mInputView.setPhoneKeyboard(keyboard);
    mInputView.setPreviewEnabled(false);
  }
  mCurrentId=id;
  mInputView.setKeyboard(keyboard);
  keyboard.setShifted(false);
  keyboard.setShiftLocked(keyboard.isShiftLocked());
  keyboard.setImeOptions(mInputMethodService.getResources(),mMode,imeOptions);
  keyboard.setColorOfSymbolIcons(mIsAutoCompletionActive,isBlackSym());
  updateSettingsKeyState(PreferenceManager.getDefaultSharedPreferences(mInputMethodService));
}

Fixed version (ground truth):
private void setKeyboardMode(int mode,int imeOptions,boolean enableVoice,boolean isSymbols){
  if (mInputView == null)   return;
  mMode=mode;
  mImeOptions=imeOptions;
  if (enableVoice != mHasVoice) {
    setVoiceMode(mHasVoice,mVoiceOnPrimary);
  }
  mIsSymbols=isSymbols;
  mInputView.setPreviewEnabled(mInputMethodService.getPopupOn());
  KeyboardId id=getKeyboardId(mode,imeOptions,isSymbols);
  LatinKeyboard keyboard=null;
  keyboard=getKeyboard(id);
  if (mode == MODE_PHONE) {
    mInputView.setPhoneKeyboard(keyboard);
  }
  mCurrentId=id;
  mInputView.setKeyboard(keyboard);
  keyboard.setShifted(false);
  keyboard.setShiftLocked(keyboard.isShiftLocked());
  keyboard.setImeOptions(mInputMethodService.getResources(),mMode,imeOptions);
  keyboard.setColorOfSymbolIcons(mIsAutoCompletionActive,isBlackSym());
  updateSettingsKeyState(PreferenceManager.getDefaultSharedPreferences(mInputMethodService));
}
Program: 88248
Project: 88248
Buggy source:
int getKeyboardMode(){
  return mMode;
}

Fixed version (ground truth):
public int getKeyboardMode(){
  return mMode;
}
Program: 88249
Project: 88249
Buggy source:
void setShifted(boolean shifted){
  if (mInputView != null) {
    mInputView.setShifted(shifted);
  }
}

Fixed version (ground truth):
public void setShifted(boolean shifted){
  if (mInputView != null) {
    mInputView.setShifted(shifted);
  }
}
Program: 88250
Project: 88250
Buggy source:
void setShiftLocked(boolean shiftLocked){
  if (mInputView != null) {
    mInputView.setShiftLocked(shiftLocked);
  }
}

Fixed version (ground truth):
public void setShiftLocked(boolean shiftLocked){
  if (mInputView != null) {
    mInputView.setShiftLocked(shiftLocked);
  }
}
Program: 88251
Project: 88251
Buggy source:
/** 
 * Updates state machine to figure out when to automatically switch back to alpha mode. Returns true if the keyboard needs to switch back 
 */
boolean onKey(int key){
switch (mSymbolsModeState) {
case SYMBOLS_MODE_STATE_BEGIN:
    if (key != LatinIME.KEYCODE_SPACE && key != LatinIME.KEYCODE_ENTER && key > 0) {
      mSymbolsModeState=SYMBOLS_MODE_STATE_SYMBOL;
    }
  break;
case SYMBOLS_MODE_STATE_SYMBOL:
if (key == LatinIME.KEYCODE_ENTER || key == LatinIME.KEYCODE_SPACE) return true;
break;
}
return false;
}

Fixed version (ground truth):
/** 
 * Updates state machine to figure out when to automatically switch back to alpha mode. Returns true if the keyboard needs to switch back 
 */
public boolean onKey(int key){
switch (mSymbolsModeState) {
case SYMBOLS_MODE_STATE_BEGIN:
    if (key != LatinIME.KEYCODE_SPACE && key != LatinIME.KEYCODE_ENTER && key > 0) {
      mSymbolsModeState=SYMBOLS_MODE_STATE_SYMBOL;
    }
  break;
case SYMBOLS_MODE_STATE_SYMBOL:
if (key == LatinIME.KEYCODE_ENTER || key == LatinIME.KEYCODE_SPACE) return true;
break;
}
return false;
}
Program: 88252
Project: 88252
Buggy source:
void toggleShift(){
  if (mCurrentId.equals(mSymbolsId)) {
    LatinKeyboard symbolsShiftedKeyboard=getKeyboard(mSymbolsShiftedId);
    mCurrentId=mSymbolsShiftedId;
    mInputView.setKeyboard(symbolsShiftedKeyboard);
    symbolsShiftedKeyboard.enableShiftLock();
    symbolsShiftedKeyboard.setShiftLocked(true);
    symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(),mMode,mImeOptions);
  }
 else   if (mCurrentId.equals(mSymbolsShiftedId)) {
    LatinKeyboard symbolsKeyboard=getKeyboard(mSymbolsId);
    mCurrentId=mSymbolsId;
    mInputView.setKeyboard(symbolsKeyboard);
    symbolsKeyboard.enableShiftLock();
    symbolsKeyboard.setShifted(false);
    symbolsKeyboard.setImeOptions(mInputMethodService.getResources(),mMode,mImeOptions);
  }
}

Fixed version (ground truth):
public void toggleShift(){
  if (mCurrentId.equals(mSymbolsId)) {
    LatinKeyboard symbolsShiftedKeyboard=getKeyboard(mSymbolsShiftedId);
    mCurrentId=mSymbolsShiftedId;
    mInputView.setKeyboard(symbolsShiftedKeyboard);
    symbolsShiftedKeyboard.enableShiftLock();
    symbolsShiftedKeyboard.setShiftLocked(true);
    symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(),mMode,mImeOptions);
  }
 else   if (mCurrentId.equals(mSymbolsShiftedId)) {
    LatinKeyboard symbolsKeyboard=getKeyboard(mSymbolsId);
    mCurrentId=mSymbolsId;
    mInputView.setKeyboard(symbolsKeyboard);
    symbolsKeyboard.enableShiftLock();
    symbolsKeyboard.setShifted(false);
    symbolsKeyboard.setImeOptions(mInputMethodService.getResources(),mMode,mImeOptions);
  }
}
Program: 88253
Project: 88253
Buggy source:
void toggleSymbols(){
  setKeyboardMode(mMode,mImeOptions,mHasVoice,!mIsSymbols);
  if (mIsSymbols && !mPreferSymbols) {
    mSymbolsModeState=SYMBOLS_MODE_STATE_BEGIN;
  }
 else {
    mSymbolsModeState=SYMBOLS_MODE_STATE_NONE;
  }
}

Fixed version (ground truth):
public void toggleSymbols(){
  setKeyboardMode(mMode,mImeOptions,mHasVoice,!mIsSymbols);
  if (mIsSymbols && !mPreferSymbols) {
    mSymbolsModeState=SYMBOLS_MODE_STATE_BEGIN;
  }
 else {
    mSymbolsModeState=SYMBOLS_MODE_STATE_NONE;
  }
}
Program: 88254
Project: 88254
Buggy source:
KeyboardSwitcher(LatinIME ims){
  mInputMethodService=ims;
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(ims);
  mLayoutId=Integer.valueOf(prefs.getString(PREF_KEYBOARD_LAYOUT,DEFAULT_LAYOUT_ID));
  updateSettingsKeyState(prefs);
  prefs.registerOnSharedPreferenceChangeListener(this);
  mKeyboards=new HashMap<KeyboardId,SoftReference<LatinKeyboard>>();
  mSymbolsId=makeSymbolsId(false);
  mSymbolsShiftedId=makeSymbolsShiftedId(false);
}

Fixed version (ground truth):
public KeyboardSwitcher(LatinIME ims){
  mInputMethodService=ims;
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(ims);
  mLayoutId=Integer.valueOf(prefs.getString(PREF_KEYBOARD_LAYOUT,DEFAULT_LAYOUT_ID));
  updateSettingsKeyState(prefs);
  prefs.registerOnSharedPreferenceChangeListener(this);
  mKeyboards=new HashMap<KeyboardId,SoftReference<LatinKeyboard>>();
  mSymbolsId=makeSymbolsId(false);
  mSymbolsShiftedId=makeSymbolsShiftedId(false);
}
Program: 88255
Project: 88255
Buggy source:
boolean isAlphabetMode(){
  if (mCurrentId == null) {
    return false;
  }
  int currentMode=mCurrentId.mKeyboardMode;
  for (  Integer mode : ALPHABET_MODES) {
    if (currentMode == mode) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isAlphabetMode(){
  if (mCurrentId == null) {
    return false;
  }
  int currentMode=mCurrentId.mKeyboardMode;
  for (  Integer mode : ALPHABET_MODES) {
    if (currentMode == mode) {
      return true;
    }
  }
  return false;
}
Program: 88256
Project: 88256
Buggy source:
boolean hasVoiceButton(boolean isSymbols){
  return mHasVoice && (isSymbols != mVoiceOnPrimary);
}

Fixed version (ground truth):
private boolean hasVoiceButton(boolean isSymbols){
  return mHasVoice && (isSymbols != mVoiceOnPrimary);
}
Program: 88257
Project: 88257
Buggy source:
void setVoiceMode(boolean enableVoice,boolean voiceOnPrimary){
  if (enableVoice != mHasVoice || voiceOnPrimary != mVoiceOnPrimary) {
    mKeyboards.clear();
  }
  mHasVoice=enableVoice;
  mVoiceOnPrimary=voiceOnPrimary;
  setKeyboardMode(mMode,mImeOptions,mHasVoice,mIsSymbols);
}

Fixed version (ground truth):
public void setVoiceMode(boolean enableVoice,boolean voiceOnPrimary){
  if (enableVoice != mHasVoice || voiceOnPrimary != mVoiceOnPrimary) {
    mKeyboards.clear();
  }
  mHasVoice=enableVoice;
  mVoiceOnPrimary=voiceOnPrimary;
  setKeyboardMode(mMode,mImeOptions,mHasVoice,mIsSymbols);
}
Program: 88258
Project: 88258
Buggy source:
/** 
 * Sets the input locale, when there are multiple locales for input. If no locale switching is required, then the locale should be set to null.
 * @param locale the current input locale, or null for default locale with no locale button.
 */
void setLanguageSwitcher(LanguageSwitcher languageSwitcher){
  mLanguageSwitcher=languageSwitcher;
  mInputLocale=mLanguageSwitcher.getInputLocale();
}

Fixed version (ground truth):
/** 
 * Sets the input locale, when there are multiple locales for input. If no locale switching is required, then the locale should be set to null.
 * @param locale the current input locale, or null for default locale with no locale button.
 */
public void setLanguageSwitcher(LanguageSwitcher languageSwitcher){
  mLanguageSwitcher=languageSwitcher;
  mInputLocale=mLanguageSwitcher.getInputLocale();
}
Program: 88259
Project: 88259
Buggy source:
void makeKeyboards(boolean forceCreate){
  mSymbolsId=makeSymbolsId(mHasVoice && !mVoiceOnPrimary);
  mSymbolsShiftedId=makeSymbolsShiftedId(mHasVoice && !mVoiceOnPrimary);
  if (forceCreate)   mKeyboards.clear();
  int displayWidth=mInputMethodService.getMaxWidth();
  if (displayWidth == mLastDisplayWidth)   return;
  mLastDisplayWidth=displayWidth;
  if (!forceCreate)   mKeyboards.clear();
}

Fixed version (ground truth):
public void makeKeyboards(boolean forceCreate){
  mSymbolsId=makeSymbolsId(mHasVoice && !mVoiceOnPrimary);
  mSymbolsShiftedId=makeSymbolsShiftedId(mHasVoice && !mVoiceOnPrimary);
  if (forceCreate)   mKeyboards.clear();
  int displayWidth=mInputMethodService.getMaxWidth();
  if (displayWidth == mLastDisplayWidth)   return;
  mLastDisplayWidth=displayWidth;
  if (!forceCreate)   mKeyboards.clear();
}
Program: 88260
Project: 88260
Buggy source:
public LatinKeyboard(Context context,int xmlLayoutResId,int mode){
  super(context,xmlLayoutResId,mode);
  final Resources res=context.getResources();
  mContext=context;
  mRes=res;
  mShiftLockIcon=res.getDrawable(R.drawable.sym_keyboard_shift_locked);
  mShiftLockPreviewIcon=res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked);
  mShiftLockPreviewIcon.setBounds(0,0,mShiftLockPreviewIcon.getIntrinsicWidth(),mShiftLockPreviewIcon.getIntrinsicHeight());
  mSpaceIcon=res.getDrawable(R.drawable.sym_keyboard_space);
  mSpaceAutoCompletionIndicator=res.getDrawable(R.drawable.sym_keyboard_space_led);
  mSpacePreviewIcon=res.getDrawable(R.drawable.sym_keyboard_feedback_space);
  mMicIcon=res.getDrawable(R.drawable.sym_keyboard_mic);
  mMicPreviewIcon=res.getDrawable(R.drawable.sym_keyboard_feedback_mic);
  setDefaultBounds(mMicPreviewIcon);
  mButtonArrowLeftIcon=res.getDrawable(R.drawable.sym_keyboard_language_arrows_left);
  mButtonArrowRightIcon=res.getDrawable(R.drawable.sym_keyboard_language_arrows_right);
  m123MicIcon=res.getDrawable(R.drawable.sym_keyboard_123_mic);
  m123MicPreviewIcon=res.getDrawable(R.drawable.sym_keyboard_feedback_123_mic);
  setDefaultBounds(m123MicPreviewIcon);
  sSpacebarVerticalCorrection=res.getDimensionPixelOffset(R.dimen.spacebar_vertical_correction);
  mIsAlphaKeyboard=xmlLayoutResId == R.xml.kbd_qwerty || xmlLayoutResId == R.xml.kbd_qwerty_black;
  mSpaceKeyIndex=indexOf(' ');
  initializeNumberHintResources(context);
}

Fixed version (ground truth):
public LatinKeyboard(Context context,int xmlLayoutResId,int mode){
  super(context,xmlLayoutResId,mode);
  final Resources res=context.getResources();
  mContext=context;
  mRes=res;
  mShiftLockIcon=res.getDrawable(R.drawable.sym_keyboard_shift_locked);
  mShiftLockPreviewIcon=res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked);
  mShiftLockPreviewIcon.setBounds(0,0,mShiftLockPreviewIcon.getIntrinsicWidth(),mShiftLockPreviewIcon.getIntrinsicHeight());
  mSpaceIcon=res.getDrawable(R.drawable.sym_keyboard_space);
  mSpaceAutoCompletionIndicator=res.getDrawable(R.drawable.sym_keyboard_space_led);
  mSpacePreviewIcon=res.getDrawable(R.drawable.sym_keyboard_feedback_space);
  mMicIcon=res.getDrawable(R.drawable.sym_keyboard_mic);
  mMicPreviewIcon=res.getDrawable(R.drawable.sym_keyboard_feedback_mic);
  setDefaultBounds(mMicPreviewIcon);
  mButtonArrowLeftIcon=res.getDrawable(R.drawable.sym_keyboard_language_arrows_left);
  mButtonArrowRightIcon=res.getDrawable(R.drawable.sym_keyboard_language_arrows_right);
  m123MicIcon=res.getDrawable(R.drawable.sym_keyboard_123_mic);
  m123MicPreviewIcon=res.getDrawable(R.drawable.sym_keyboard_feedback_123_mic);
  setDefaultBounds(m123MicPreviewIcon);
  sSpacebarVerticalCorrection=res.getDimensionPixelOffset(R.dimen.spacebar_vertical_correction);
  mIsAlphaKeyboard=xmlLayoutResId == R.xml.kbd_qwerty || xmlLayoutResId == R.xml.kbd_qwerty_black;
  mSpaceKeyIndex=indexOf(LatinIME.KEYCODE_SPACE);
  initializeNumberHintResources(context);
}
Program: 88261
Project: 88261
Buggy source:
public void showPreview(int keyIndex,PointerTracker tracker){
  int oldKeyIndex=mOldPreviewKeyIndex;
  mOldPreviewKeyIndex=keyIndex;
  if (oldKeyIndex != keyIndex && mShowPreview) {
    if (keyIndex == NOT_A_KEY) {
      mHandler.cancelPopupPreview();
      mHandler.dismissPreview(DELAY_AFTER_PREVIEW);
    }
 else     if (tracker != null) {
      mHandler.popupPreview(DELAY_BEFORE_PREVIEW,keyIndex,tracker);
    }
  }
}

Fixed version (ground truth):
public void showPreview(int keyIndex,PointerTracker tracker){
  int oldKeyIndex=mOldPreviewKeyIndex;
  mOldPreviewKeyIndex=keyIndex;
  final boolean isLanguageSwitchEnabled=(mKeyboard instanceof LatinKeyboard) && ((LatinKeyboard)mKeyboard).isLanguageSwitchEnabled();
  final boolean hidePreviewOrShowSpaceKeyPreview=(tracker == null) || tracker.isSpaceKey(keyIndex) || tracker.isSpaceKey(oldKeyIndex);
  if (oldKeyIndex != keyIndex && (mShowPreview || (hidePreviewOrShowSpaceKeyPreview && isLanguageSwitchEnabled))) {
    if (keyIndex == NOT_A_KEY) {
      mHandler.cancelPopupPreview();
      mHandler.dismissPreview(DELAY_AFTER_PREVIEW);
    }
 else     if (tracker != null) {
      mHandler.popupPreview(DELAY_BEFORE_PREVIEW,keyIndex,tracker);
    }
  }
}
Program: 88262
Project: 88262
Buggy source:
void setKeyboardMode(int mode,int imeOptions,boolean enableVoice,boolean isSymbols){
  if (mInputView == null)   return;
  mMode=mode;
  mImeOptions=imeOptions;
  if (enableVoice != mHasVoice) {
    setVoiceMode(mHasVoice,mVoiceOnPrimary);
  }
  mIsSymbols=isSymbols;
  mInputView.setPreviewEnabled(mInputMethodService.getPopupOn());
  KeyboardId id=getKeyboardId(mode,imeOptions,isSymbols);
  LatinKeyboard keyboard=null;
  keyboard=getKeyboard(id);
  if (mode == MODE_PHONE) {
    mInputView.setPhoneKeyboard(keyboard);
    mInputView.setPreviewEnabled(false);
  }
  mCurrentId=id;
  mInputView.setKeyboard(keyboard);
  keyboard.setShifted(false);
  keyboard.setShiftLocked(keyboard.isShiftLocked());
  keyboard.setImeOptions(mInputMethodService.getResources(),mMode,imeOptions);
  keyboard.setColorOfSymbolIcons(mIsAutoCompletionActive,isBlackSym());
  updateSettingsKeyState(PreferenceManager.getDefaultSharedPreferences(mInputMethodService));
}

Fixed version (ground truth):
private void setKeyboardMode(int mode,int imeOptions,boolean enableVoice,boolean isSymbols){
  if (mInputView == null)   return;
  mMode=mode;
  mImeOptions=imeOptions;
  if (enableVoice != mHasVoice) {
    setVoiceMode(mHasVoice,mVoiceOnPrimary);
  }
  mIsSymbols=isSymbols;
  mInputView.setPreviewEnabled(mInputMethodService.getPopupOn());
  KeyboardId id=getKeyboardId(mode,imeOptions,isSymbols);
  LatinKeyboard keyboard=null;
  keyboard=getKeyboard(id);
  if (mode == MODE_PHONE) {
    mInputView.setPhoneKeyboard(keyboard);
  }
  mCurrentId=id;
  mInputView.setKeyboard(keyboard);
  keyboard.setShifted(false);
  keyboard.setShiftLocked(keyboard.isShiftLocked());
  keyboard.setImeOptions(mInputMethodService.getResources(),mMode,imeOptions);
  keyboard.setColorOfSymbolIcons(mIsAutoCompletionActive,isBlackSym());
  updateSettingsKeyState(PreferenceManager.getDefaultSharedPreferences(mInputMethodService));
}
Program: 88263
Project: 88263
Buggy source:
int getKeyboardMode(){
  return mMode;
}

Fixed version (ground truth):
public int getKeyboardMode(){
  return mMode;
}
Program: 88264
Project: 88264
Buggy source:
void setShifted(boolean shifted){
  if (mInputView != null) {
    mInputView.setShifted(shifted);
  }
}

Fixed version (ground truth):
public void setShifted(boolean shifted){
  if (mInputView != null) {
    mInputView.setShifted(shifted);
  }
}
Program: 88265
Project: 88265
Buggy source:
void setShiftLocked(boolean shiftLocked){
  if (mInputView != null) {
    mInputView.setShiftLocked(shiftLocked);
  }
}

Fixed version (ground truth):
public void setShiftLocked(boolean shiftLocked){
  if (mInputView != null) {
    mInputView.setShiftLocked(shiftLocked);
  }
}
Program: 88266
Project: 88266
Buggy source:
/** 
 * Updates state machine to figure out when to automatically switch back to alpha mode. Returns true if the keyboard needs to switch back 
 */
boolean onKey(int key){
switch (mSymbolsModeState) {
case SYMBOLS_MODE_STATE_BEGIN:
    if (key != LatinIME.KEYCODE_SPACE && key != LatinIME.KEYCODE_ENTER && key > 0) {
      mSymbolsModeState=SYMBOLS_MODE_STATE_SYMBOL;
    }
  break;
case SYMBOLS_MODE_STATE_SYMBOL:
if (key == LatinIME.KEYCODE_ENTER || key == LatinIME.KEYCODE_SPACE) return true;
break;
}
return false;
}

Fixed version (ground truth):
/** 
 * Updates state machine to figure out when to automatically switch back to alpha mode. Returns true if the keyboard needs to switch back 
 */
public boolean onKey(int key){
switch (mSymbolsModeState) {
case SYMBOLS_MODE_STATE_BEGIN:
    if (key != LatinIME.KEYCODE_SPACE && key != LatinIME.KEYCODE_ENTER && key > 0) {
      mSymbolsModeState=SYMBOLS_MODE_STATE_SYMBOL;
    }
  break;
case SYMBOLS_MODE_STATE_SYMBOL:
if (key == LatinIME.KEYCODE_ENTER || key == LatinIME.KEYCODE_SPACE) return true;
break;
}
return false;
}
Program: 88267
Project: 88267
Buggy source:
void toggleShift(){
  if (mCurrentId.equals(mSymbolsId)) {
    LatinKeyboard symbolsShiftedKeyboard=getKeyboard(mSymbolsShiftedId);
    mCurrentId=mSymbolsShiftedId;
    mInputView.setKeyboard(symbolsShiftedKeyboard);
    symbolsShiftedKeyboard.enableShiftLock();
    symbolsShiftedKeyboard.setShiftLocked(true);
    symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(),mMode,mImeOptions);
  }
 else   if (mCurrentId.equals(mSymbolsShiftedId)) {
    LatinKeyboard symbolsKeyboard=getKeyboard(mSymbolsId);
    mCurrentId=mSymbolsId;
    mInputView.setKeyboard(symbolsKeyboard);
    symbolsKeyboard.enableShiftLock();
    symbolsKeyboard.setShifted(false);
    symbolsKeyboard.setImeOptions(mInputMethodService.getResources(),mMode,mImeOptions);
  }
}

Fixed version (ground truth):
public void toggleShift(){
  if (mCurrentId.equals(mSymbolsId)) {
    LatinKeyboard symbolsShiftedKeyboard=getKeyboard(mSymbolsShiftedId);
    mCurrentId=mSymbolsShiftedId;
    mInputView.setKeyboard(symbolsShiftedKeyboard);
    symbolsShiftedKeyboard.enableShiftLock();
    symbolsShiftedKeyboard.setShiftLocked(true);
    symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(),mMode,mImeOptions);
  }
 else   if (mCurrentId.equals(mSymbolsShiftedId)) {
    LatinKeyboard symbolsKeyboard=getKeyboard(mSymbolsId);
    mCurrentId=mSymbolsId;
    mInputView.setKeyboard(symbolsKeyboard);
    symbolsKeyboard.enableShiftLock();
    symbolsKeyboard.setShifted(false);
    symbolsKeyboard.setImeOptions(mInputMethodService.getResources(),mMode,mImeOptions);
  }
}
Program: 88268
Project: 88268
Buggy source:
void toggleSymbols(){
  setKeyboardMode(mMode,mImeOptions,mHasVoice,!mIsSymbols);
  if (mIsSymbols && !mPreferSymbols) {
    mSymbolsModeState=SYMBOLS_MODE_STATE_BEGIN;
  }
 else {
    mSymbolsModeState=SYMBOLS_MODE_STATE_NONE;
  }
}

Fixed version (ground truth):
public void toggleSymbols(){
  setKeyboardMode(mMode,mImeOptions,mHasVoice,!mIsSymbols);
  if (mIsSymbols && !mPreferSymbols) {
    mSymbolsModeState=SYMBOLS_MODE_STATE_BEGIN;
  }
 else {
    mSymbolsModeState=SYMBOLS_MODE_STATE_NONE;
  }
}
Program: 88269
Project: 88269
Buggy source:
KeyboardSwitcher(LatinIME ims){
  mInputMethodService=ims;
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(ims);
  mLayoutId=Integer.valueOf(prefs.getString(PREF_KEYBOARD_LAYOUT,DEFAULT_LAYOUT_ID));
  updateSettingsKeyState(prefs);
  prefs.registerOnSharedPreferenceChangeListener(this);
  mKeyboards=new HashMap<KeyboardId,SoftReference<LatinKeyboard>>();
  mSymbolsId=makeSymbolsId(false);
  mSymbolsShiftedId=makeSymbolsShiftedId(false);
}

Fixed version (ground truth):
public KeyboardSwitcher(LatinIME ims){
  mInputMethodService=ims;
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(ims);
  mLayoutId=Integer.valueOf(prefs.getString(PREF_KEYBOARD_LAYOUT,DEFAULT_LAYOUT_ID));
  updateSettingsKeyState(prefs);
  prefs.registerOnSharedPreferenceChangeListener(this);
  mKeyboards=new HashMap<KeyboardId,SoftReference<LatinKeyboard>>();
  mSymbolsId=makeSymbolsId(false);
  mSymbolsShiftedId=makeSymbolsShiftedId(false);
}
Program: 88270
Project: 88270
Buggy source:
boolean isAlphabetMode(){
  if (mCurrentId == null) {
    return false;
  }
  int currentMode=mCurrentId.mKeyboardMode;
  for (  Integer mode : ALPHABET_MODES) {
    if (currentMode == mode) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isAlphabetMode(){
  if (mCurrentId == null) {
    return false;
  }
  int currentMode=mCurrentId.mKeyboardMode;
  for (  Integer mode : ALPHABET_MODES) {
    if (currentMode == mode) {
      return true;
    }
  }
  return false;
}
Program: 88271
Project: 88271
Buggy source:
boolean hasVoiceButton(boolean isSymbols){
  return mHasVoice && (isSymbols != mVoiceOnPrimary);
}

Fixed version (ground truth):
private boolean hasVoiceButton(boolean isSymbols){
  return mHasVoice && (isSymbols != mVoiceOnPrimary);
}
Program: 88272
Project: 88272
Buggy source:
void setVoiceMode(boolean enableVoice,boolean voiceOnPrimary){
  if (enableVoice != mHasVoice || voiceOnPrimary != mVoiceOnPrimary) {
    mKeyboards.clear();
  }
  mHasVoice=enableVoice;
  mVoiceOnPrimary=voiceOnPrimary;
  setKeyboardMode(mMode,mImeOptions,mHasVoice,mIsSymbols);
}

Fixed version (ground truth):
public void setVoiceMode(boolean enableVoice,boolean voiceOnPrimary){
  if (enableVoice != mHasVoice || voiceOnPrimary != mVoiceOnPrimary) {
    mKeyboards.clear();
  }
  mHasVoice=enableVoice;
  mVoiceOnPrimary=voiceOnPrimary;
  setKeyboardMode(mMode,mImeOptions,mHasVoice,mIsSymbols);
}
Program: 88273
Project: 88273
Buggy source:
/** 
 * Sets the input locale, when there are multiple locales for input. If no locale switching is required, then the locale should be set to null.
 * @param locale the current input locale, or null for default locale with no locale button.
 */
void setLanguageSwitcher(LanguageSwitcher languageSwitcher){
  mLanguageSwitcher=languageSwitcher;
  mInputLocale=mLanguageSwitcher.getInputLocale();
}

Fixed version (ground truth):
/** 
 * Sets the input locale, when there are multiple locales for input. If no locale switching is required, then the locale should be set to null.
 * @param locale the current input locale, or null for default locale with no locale button.
 */
public void setLanguageSwitcher(LanguageSwitcher languageSwitcher){
  mLanguageSwitcher=languageSwitcher;
  mInputLocale=mLanguageSwitcher.getInputLocale();
}
Program: 88274
Project: 88274
Buggy source:
void makeKeyboards(boolean forceCreate){
  mSymbolsId=makeSymbolsId(mHasVoice && !mVoiceOnPrimary);
  mSymbolsShiftedId=makeSymbolsShiftedId(mHasVoice && !mVoiceOnPrimary);
  if (forceCreate)   mKeyboards.clear();
  int displayWidth=mInputMethodService.getMaxWidth();
  if (displayWidth == mLastDisplayWidth)   return;
  mLastDisplayWidth=displayWidth;
  if (!forceCreate)   mKeyboards.clear();
}

Fixed version (ground truth):
public void makeKeyboards(boolean forceCreate){
  mSymbolsId=makeSymbolsId(mHasVoice && !mVoiceOnPrimary);
  mSymbolsShiftedId=makeSymbolsShiftedId(mHasVoice && !mVoiceOnPrimary);
  if (forceCreate)   mKeyboards.clear();
  int displayWidth=mInputMethodService.getMaxWidth();
  if (displayWidth == mLastDisplayWidth)   return;
  mLastDisplayWidth=displayWidth;
  if (!forceCreate)   mKeyboards.clear();
}