nus-yam/ex-repair huggingface dataset:
Program: 23962
Project: 23962
Buggy source:
/** 
 * Stops all speech output and removes any utterances still in the queue globally.
 */
private int stopAll(String callingApp){
  int result=TextToSpeech.ERROR;
  boolean speechQueueAvailable=false;
  try {
    speechQueueAvailable=speechQueueLock.tryLock(SPEECHQUEUELOCK_TIMEOUT,TimeUnit.MILLISECONDS);
    if (speechQueueAvailable) {
      for (int i=mSpeechQueue.size() - 1; i > -1; i--) {
        if (mSpeechQueue.get(i).mType != SpeechItem.TEXT_TO_FILE) {
          mSpeechQueue.remove(i);
        }
      }
      if ((mCurrentSpeechItem != null) && ((mCurrentSpeechItem.mType != SpeechItem.TEXT_TO_FILE) || mCurrentSpeechItem.mCallingApp.equals(callingApp))) {
        result=sNativeSynth.stop();
        mKillList.put(mCurrentSpeechItem,true);
        if (mPlayer != null) {
          try {
            mPlayer.stop();
          }
 catch (          IllegalStateException e) {
          }
        }
        mIsSpeaking=false;
        mCurrentSpeechItem=null;
      }
 else {
        result=TextToSpeech.SUCCESS;
      }
      Log.i("String_Node_Str","String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    Log.e("String_Node_Str","String_Node_Str");
    e.printStackTrace();
  }
 finally {
    if (speechQueueAvailable) {
      speechQueueLock.unlock();
    }
    return result;
  }
}

Fixed version (ground truth):
/** 
 * Stops all speech output and removes any utterances still in the queue globally.
 */
private int stopAll(String callingApp){
  int result=TextToSpeech.ERROR;
  boolean speechQueueAvailable=false;
  try {
    speechQueueAvailable=speechQueueLock.tryLock(SPEECHQUEUELOCK_TIMEOUT,TimeUnit.MILLISECONDS);
    if (speechQueueAvailable) {
      for (int i=mSpeechQueue.size() - 1; i > -1; i--) {
        if (mSpeechQueue.get(i).mType != SpeechItem.TEXT_TO_FILE) {
          mSpeechQueue.remove(i);
        }
      }
      if ((mCurrentSpeechItem != null) && ((mCurrentSpeechItem.mType != SpeechItem.TEXT_TO_FILE) || mCurrentSpeechItem.mCallingApp.equals(callingApp))) {
        if (sIsKillingSynth) {
          Log.v("String_Node_Str","String_Node_Str");
          result=TextToSpeech.ERROR;
        }
 else {
          result=sNativeSynth.stop();
        }
        mKillList.put(mCurrentSpeechItem,true);
        if (mPlayer != null) {
          try {
            mPlayer.stop();
          }
 catch (          IllegalStateException e) {
          }
        }
        mIsSpeaking=false;
        mCurrentSpeechItem=null;
      }
 else {
        result=TextToSpeech.SUCCESS;
      }
      Log.i("String_Node_Str","String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    Log.e("String_Node_Str","String_Node_Str");
    e.printStackTrace();
  }
 finally {
    if (speechQueueAvailable) {
      speechQueueLock.unlock();
    }
    return result;
  }
}
Program: 23963
Project: 23963
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  Log.i("String_Node_Str","String_Node_Str");
  mResolver=getContentResolver();
  String soLibPath="String_Node_Str";
  if (sNativeSynth == null) {
    sNativeSynth=new SynthProxy(soLibPath);
  }
  mSelf=this;
  mIsSpeaking=false;
  mEarcons=new HashMap<String,SoundResource>();
  mUtterances=new HashMap<String,SoundResource>();
  mCallbacksMap=new HashMap<String,android.speech.tts.ITtsCallback>();
  mSpeechQueue=new ArrayList<SpeechItem>();
  mPlayer=null;
  mCurrentSpeechItem=null;
  mKillList=new HashMap<SpeechItem,Boolean>();
  setDefaultSettings();
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  Log.i("String_Node_Str","String_Node_Str");
  mResolver=getContentResolver();
  String soLibPath="String_Node_Str";
  if (sNativeSynth == null) {
    sNativeSynth=new SynthProxy(soLibPath);
    sIsKillingSynth=false;
  }
  mSelf=this;
  mIsSpeaking=false;
  mEarcons=new HashMap<String,SoundResource>();
  mUtterances=new HashMap<String,SoundResource>();
  mCallbacksMap=new HashMap<String,android.speech.tts.ITtsCallback>();
  mSpeechQueue=new ArrayList<SpeechItem>();
  mPlayer=null;
  mCurrentSpeechItem=null;
  mKillList=new HashMap<SpeechItem,Boolean>();
  setDefaultSettings();
}
Program: 23964
Project: 23964
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  cleanUpPlayer();
  sNativeSynth.shutdown();
  sNativeSynth=null;
  mCallbacks.kill();
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  sIsKillingSynth=true;
  Log.i("String_Node_Str","String_Node_Str");
  cleanUpPlayer();
  sNativeSynth.shutdown();
  sNativeSynth=null;
  mCallbacks.kill();
}
Program: 23967
Project: 23967
Buggy source:
private static Integer signalParamHash(int signalType,int alertPitch,int signal){
  if ((signalType < 0) || (signalType > 256) || (alertPitch > 256)|| (alertPitch < 0)|| (signal > 256)|| (signal < 0)) {
    return new Integer(CDMA_INVALID_TONE);
  }
  return new Integer(signalType * 256 * 256 + alertPitch * 256 + signal);
}

Fixed version (ground truth):
private static Integer signalParamHash(int signalType,int alertPitch,int signal){
  if ((signalType < 0) || (signalType > 256) || (alertPitch > 256)|| (alertPitch < 0)|| (signal > 256)|| (signal < 0)) {
    return new Integer(CDMA_INVALID_TONE);
  }
  if (signalType != IS95_CONST_IR_SIGNAL_IS54B) {
    alertPitch=TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN;
  }
  return new Integer(signalType * 256 * 256 + alertPitch * 256 + signal);
}
Program: 23968
Project: 23968
Buggy source:
/** 
 * SSL certificate error callback. Handles SSL error(s) on the way up to the user.
 */
public void handleSslErrorRequest(SslError error){
  int primaryError=error.getPrimaryError();
  if (Config.LOGV) {
    Log.v(LOGTAG,"String_Node_Str" + "String_Node_Str" + primaryError + "String_Node_Str"+ error.getCertificate());
  }
  eventsReceived[TEST_SSL_CERTIFICATE_ERROR]=true;
  if (notExpecting[TEST_SSL_CERTIFICATE_ERROR]) {
    expectDetails.append("String_Node_Str" + "String_Node_Str");
    expectDetails.append("String_Node_Str");
  }
  if (expectSslErrors != -1) {
    if (expectSslErrors == primaryError) {
      expectSslErrors=-1;
    }
 else {
      expectDetails.append("String_Node_Str" + expectSslErrors + "String_Node_Str"+ primaryError);
      expectDetails.append("String_Node_Str");
    }
  }
  if (expectSslErrors == -1)   expects[TEST_SSL_CERTIFICATE_ERROR]=false;
}

Fixed version (ground truth):
/** 
 * SSL certificate error callback. Handles SSL error(s) on the way up to the user.
 */
public boolean handleSslErrorRequest(SslError error){
  int primaryError=error.getPrimaryError();
  if (Config.LOGV) {
    Log.v(LOGTAG,"String_Node_Str" + "String_Node_Str" + primaryError + "String_Node_Str"+ error.getCertificate());
  }
  eventsReceived[TEST_SSL_CERTIFICATE_ERROR]=true;
  if (notExpecting[TEST_SSL_CERTIFICATE_ERROR]) {
    expectDetails.append("String_Node_Str" + "String_Node_Str");
    expectDetails.append("String_Node_Str");
  }
  if (expectSslErrors != -1) {
    if (expectSslErrors == primaryError) {
      expectSslErrors=-1;
    }
 else {
      expectDetails.append("String_Node_Str" + expectSslErrors + "String_Node_Str"+ primaryError);
      expectDetails.append("String_Node_Str");
    }
  }
  if (expectSslErrors == -1)   expects[TEST_SSL_CERTIFICATE_ERROR]=false;
  return false;
}
Program: 23969
Project: 23969
Buggy source:
private void setContentScrollBy(int cx,int cy,boolean animate){
  if (mDrawHistory) {
    return;
  }
  cx=contentToView(cx);
  cy=contentToView(cy);
  if (mHeightCanMeasure) {
    if (cy != 0) {
      Rect tempRect=new Rect();
      calcOurVisibleRect(tempRect);
      tempRect.offset(cx,cy);
      requestRectangleOnScreen(tempRect);
    }
    if (cy == 0 && cx != 0) {
      pinScrollBy(cx,0,animate,0);
    }
  }
 else {
    pinScrollBy(cx,cy,animate,0);
  }
}

Fixed version (ground truth):
private boolean setContentScrollBy(int cx,int cy,boolean animate){
  if (mDrawHistory) {
    return false;
  }
  cx=contentToView(cx);
  cy=contentToView(cy);
  if (mHeightCanMeasure) {
    if (cy != 0) {
      Rect tempRect=new Rect();
      calcOurVisibleRect(tempRect);
      tempRect.offset(cx,cy);
      requestRectangleOnScreen(tempRect);
    }
    return cy == 0 && cx != 0 && pinScrollBy(cx,0,animate,0);
  }
 else {
    return pinScrollBy(cx,cy,animate,0);
  }
}
Program: 23972
Project: 23972
Buggy source:
public void setImageMatrix(Matrix matrix){
  if (matrix != null && matrix.isIdentity()) {
    matrix=null;
  }
  if (matrix == null && !mMatrix.isIdentity() || matrix != null && !mMatrix.equals(matrix)) {
    mMatrix.set(matrix);
    invalidate();
  }
}

Fixed version (ground truth):
public void setImageMatrix(Matrix matrix){
  if (matrix != null && matrix.isIdentity()) {
    matrix=null;
  }
  if (matrix == null && !mMatrix.isIdentity() || matrix != null && !mMatrix.equals(matrix)) {
    mMatrix.set(matrix);
    configureBounds();
    invalidate();
  }
}
Program: 23973
Project: 23973
Buggy source:
/** 
 * Handle   {@link #MSG_BATTERY_UPDATE}
 */
private void handleBatteryUpdate(int pluggedInStatus,int batteryLevel){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  final boolean pluggedIn=isPluggedIn(pluggedInStatus);
  if (isBatteryUpdateInteresting(pluggedIn,batteryLevel)) {
    mBatteryLevel=batteryLevel;
    mDevicePluggedIn=pluggedIn;
    for (int i=0; i < mInfoCallbacks.size(); i++) {
      mInfoCallbacks.get(i).onRefreshBatteryInfo(shouldShowBatteryInfo(),pluggedIn,batteryLevel);
    }
  }
  if (batteryLevel == 0 && pluggedInStatus != BATTERY_STATUS_CHARGING && pluggedInStatus != BATTERY_STATUS_UNKNOWN) {
    ShutdownThread.shutdown(mContext,false);
  }
}

Fixed version (ground truth):
/** 
 * Handle   {@link #MSG_BATTERY_UPDATE}
 */
private void handleBatteryUpdate(int pluggedInStatus,int batteryLevel){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  final boolean pluggedIn=isPluggedIn(pluggedInStatus);
  if (isBatteryUpdateInteresting(pluggedIn,batteryLevel)) {
    mBatteryLevel=batteryLevel;
    mDevicePluggedIn=pluggedIn;
    for (int i=0; i < mInfoCallbacks.size(); i++) {
      mInfoCallbacks.get(i).onRefreshBatteryInfo(shouldShowBatteryInfo(),pluggedIn,batteryLevel);
    }
  }
}
Program: 23974
Project: 23974
Buggy source:
/** 
 * Performs   {@link AccessibilityService}s delayed notification. The delay is configurable and denotes the period after the last event before notifying the service.
 * @param event The event.
 * @param isDefault True to notify default listeners, not default services.
 */
private void notifyAccessibilityServicesDelayedLocked(AccessibilityEvent event,boolean isDefault){
  for (int i=0, count=mServices.size(); i < count; i++) {
    Service service=mServices.get(i);
    if (service.mIsDefault == isDefault) {
      if (canDispathEventLocked(service,event,mHandledFeedbackTypes)) {
        mHandledFeedbackTypes|=service.mFeedbackType;
        notifyAccessibilityServiceDelayedLocked(service,event);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs   {@link AccessibilityService}s delayed notification. The delay is configurable and denotes the period after the last event before notifying the service.
 * @param event The event.
 * @param isDefault True to notify default listeners, not default services.
 */
private void notifyAccessibilityServicesDelayedLocked(AccessibilityEvent event,boolean isDefault){
  try {
    for (int i=0, count=mServices.size(); i < count; i++) {
      Service service=mServices.get(i);
      if (service.mIsDefault == isDefault) {
        if (canDispathEventLocked(service,event,mHandledFeedbackTypes)) {
          mHandledFeedbackTypes|=service.mFeedbackType;
          notifyAccessibilityServiceDelayedLocked(service,event);
        }
      }
    }
  }
 catch (  IndexOutOfBoundsException oobe) {
    return;
  }
}
Program: 23976
Project: 23976
Buggy source:
static void sendCloseSystemWindows(Context context,String reason){
  if (ActivityManagerNative.isSystemReady()) {
    Intent intent=new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    if (reason != null) {
      intent.putExtra(SYSTEM_DIALOG_REASON_KEY,reason);
    }
    context.sendBroadcast(intent);
  }
}

Fixed version (ground truth):
static void sendCloseSystemWindows(Context context,String reason){
  if (ActivityManagerNative.isSystemReady()) {
    try {
      ActivityManagerNative.getDefault().closeSystemDialogs(reason);
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 23977
Project: 23977
Buggy source:
/** 
 * goes to the home screen
 * @return whether it did anything
 */
boolean goHome(){
  if (false) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
      int result=ActivityManagerNative.getDefault().startActivity(null,mHomeIntent,mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),null,0,null,null,0,true,false);
      if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
        return false;
      }
    }
 catch (    RemoteException ex) {
    }
  }
  sendCloseSystemWindows();
  return true;
}

Fixed version (ground truth):
/** 
 * goes to the home screen
 * @return whether it did anything
 */
boolean goHome(){
  if (false) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
      sendCloseSystemWindows();
      int result=ActivityManagerNative.getDefault().startActivity(null,mHomeIntent,mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),null,0,null,null,0,true,false);
      if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
        return false;
      }
    }
 catch (    RemoteException ex) {
    }
  }
  return true;
}
Program: 23978
Project: 23978
Buggy source:
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowing()) {
  }
 else   if (mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          mContext.startActivity(mHomeIntent);
          sendCloseSystemWindows();
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
    sendCloseSystemWindows();
  }
}

Fixed version (ground truth):
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowing()) {
  }
 else   if (mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          sendCloseSystemWindows();
          mContext.startActivity(mHomeIntent);
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
}
Program: 23979
Project: 23979
Buggy source:
public void onKeyguardExitResult(boolean success){
  if (success) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
    sendCloseSystemWindows();
  }
}

Fixed version (ground truth):
public void onKeyguardExitResult(boolean success){
  if (success) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
}
Program: 23980
Project: 23980
Buggy source:
/** 
 * Checks whether the speakerphone is on or off.
 * @return true if speakerphone is on, false if it's off
 */
public boolean isSpeakerphoneOn(){
  if (AudioSystem.getForceUse(AudioSystem.FOR_COMMUNICATION) == AudioSystem.FORCE_SPEAKER) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks whether the speakerphone is on or off.
 * @return true if speakerphone is on, false if it's off
 */
public boolean isSpeakerphoneOn(){
  IAudioService service=getService();
  try {
    return service.isSpeakerphoneOn();
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    return false;
  }
}
Program: 23981
Project: 23981
Buggy source:
/** 
 * Request use of Bluetooth SCO headset for communications.
 * @param on set <var>true</var> to use bluetooth SCO for communications;<var>false</var> to not use bluetooth SCO for communications
 */
public void setBluetoothScoOn(boolean on){
  if (on) {
    AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,AudioSystem.FORCE_BT_SCO);
  }
 else {
    AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,AudioSystem.FORCE_NONE);
  }
}

Fixed version (ground truth):
/** 
 * Request use of Bluetooth SCO headset for communications.
 * @param on set <var>true</var> to use bluetooth SCO for communications;<var>false</var> to not use bluetooth SCO for communications
 */
public void setBluetoothScoOn(boolean on){
  IAudioService service=getService();
  try {
    service.setBluetoothScoOn(on);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 23982
Project: 23982
Buggy source:
/** 
 * Sets the speakerphone on or off.
 * @param on set <var>true</var> to turn on speakerphone;<var>false</var> to turn it off
 */
public void setSpeakerphoneOn(boolean on){
  if (on) {
    AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,AudioSystem.FORCE_SPEAKER);
  }
 else {
    AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,AudioSystem.FORCE_NONE);
  }
}

Fixed version (ground truth):
/** 
 * Sets the speakerphone on or off.
 * @param on set <var>true</var> to turn on speakerphone;<var>false</var> to turn it off
 */
public void setSpeakerphoneOn(boolean on){
  IAudioService service=getService();
  try {
    service.setSpeakerphoneOn(on);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 23983
Project: 23983
Buggy source:
/** 
 * Checks whether communications use Bluetooth SCO.
 * @return true if SCO is used for communications;false if otherwise
 */
public boolean isBluetoothScoOn(){
  if (AudioSystem.getForceUse(AudioSystem.FOR_COMMUNICATION) == AudioSystem.FORCE_BT_SCO) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks whether communications use Bluetooth SCO.
 * @return true if SCO is used for communications;false if otherwise
 */
public boolean isBluetoothScoOn(){
  IAudioService service=getService();
  try {
    return service.isBluetoothScoOn();
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    return false;
  }
}
Program: 23984
Project: 23984
Buggy source:
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.SINK_STATE_CHANGED_ACTION);
  intentFilter.addAction(BluetoothIntent.HEADSET_AUDIO_STATE_CHANGED_ACTION);
  context.registerReceiver(mReceiver,intentFilter);
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mMode=AudioSystem.MODE_NORMAL;
  mHeadsetState=0;
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.SINK_STATE_CHANGED_ACTION);
  intentFilter.addAction(BluetoothIntent.HEADSET_AUDIO_STATE_CHANGED_ACTION);
  context.registerReceiver(mReceiver,intentFilter);
}
Program: 23986
Project: 23986
Buggy source:
@Override public void handleMessage(Message msg){
  int baseMsgWhat=getMsgBase(msg.what);
switch (baseMsgWhat) {
case MSG_SET_SYSTEM_VOLUME:
    setSystemVolume((VolumeStreamState)msg.obj);
  break;
case MSG_PERSIST_VOLUME:
persistVolume((VolumeStreamState)msg.obj);
break;
case MSG_PERSIST_RINGER_MODE:
persistRingerMode();
break;
case MSG_PERSIST_VIBRATE_SETTING:
persistVibrateSetting();
break;
case MSG_MEDIA_SERVER_DIED:
Log.e(TAG,"String_Node_Str");
mMediaServerOk=false;
AudioSystem.getMode();
break;
case MSG_MEDIA_SERVER_STARTED:
Log.e(TAG,"String_Node_Str");
int numStreamTypes=AudioSystem.getNumStreamTypes();
for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
int index;
VolumeStreamState streamState=mStreamStates[streamType];
if (streamState.muteCount() == 0) {
index=streamState.mIndex;
}
 else {
index=0;
}
setStreamVolumeIndex(streamType,index);
}
setRingerMode(mRingerMode);
mMediaServerOk=true;
break;
case MSG_PLAY_SOUND_EFFECT:
playSoundEffect(msg.arg1,msg.arg2);
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  int baseMsgWhat=getMsgBase(msg.what);
switch (baseMsgWhat) {
case MSG_SET_SYSTEM_VOLUME:
    setSystemVolume((VolumeStreamState)msg.obj);
  break;
case MSG_PERSIST_VOLUME:
persistVolume((VolumeStreamState)msg.obj);
break;
case MSG_PERSIST_RINGER_MODE:
persistRingerMode();
break;
case MSG_PERSIST_VIBRATE_SETTING:
persistVibrateSetting();
break;
case MSG_MEDIA_SERVER_DIED:
Log.e(TAG,"String_Node_Str");
mMediaServerOk=false;
AudioSystem.isMusicActive();
break;
case MSG_MEDIA_SERVER_STARTED:
Log.e(TAG,"String_Node_Str");
Set set=mConnectedDevices.entrySet();
Iterator i=set.iterator();
while (i.hasNext()) {
Map.Entry device=(Map.Entry)i.next();
AudioSystem.setDeviceConnectionState(((Integer)device.getKey()).intValue(),AudioSystem.DEVICE_STATE_AVAILABLE,(String)device.getValue());
}
AudioSystem.setPhoneState(mMode);
AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,mForcedUseForComm);
int numStreamTypes=AudioSystem.getNumStreamTypes();
for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
int index;
VolumeStreamState streamState=mStreamStates[streamType];
AudioSystem.initStreamVolume(streamType,0,(streamState.mIndexMax + 5) / 10);
if (streamState.muteCount() == 0) {
index=streamState.mIndex;
}
 else {
index=0;
}
setStreamVolumeIndex(streamType,index);
}
setRingerModeInt(getRingerMode(),false);
mMediaServerOk=true;
break;
case MSG_PLAY_SOUND_EFFECT:
playSoundEffect(msg.arg1,msg.arg2);
break;
}
}
Program: 23988
Project: 23988
Buggy source:
static void sendCloseSystemWindows(Context context,String reason){
  if (ActivityManagerNative.isSystemReady()) {
    Intent intent=new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    if (reason != null) {
      intent.putExtra(SYSTEM_DIALOG_REASON_KEY,reason);
    }
    context.sendBroadcast(intent);
  }
}

Fixed version (ground truth):
static void sendCloseSystemWindows(Context context,String reason){
  if (ActivityManagerNative.isSystemReady()) {
    try {
      ActivityManagerNative.getDefault().closeSystemDialogs(reason);
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 23989
Project: 23989
Buggy source:
/** 
 * goes to the home screen
 * @return whether it did anything
 */
boolean goHome(){
  if (false) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
      int result=ActivityManagerNative.getDefault().startActivity(null,mHomeIntent,mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),null,0,null,null,0,true,false);
      if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
        return false;
      }
    }
 catch (    RemoteException ex) {
    }
  }
  sendCloseSystemWindows();
  return true;
}

Fixed version (ground truth):
/** 
 * goes to the home screen
 * @return whether it did anything
 */
boolean goHome(){
  if (false) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
      sendCloseSystemWindows();
      int result=ActivityManagerNative.getDefault().startActivity(null,mHomeIntent,mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),null,0,null,null,0,true,false);
      if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
        return false;
      }
    }
 catch (    RemoteException ex) {
    }
  }
  return true;
}
Program: 23990
Project: 23990
Buggy source:
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowing()) {
  }
 else   if (mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          mContext.startActivity(mHomeIntent);
          sendCloseSystemWindows();
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
    sendCloseSystemWindows();
  }
}

Fixed version (ground truth):
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowing()) {
  }
 else   if (mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          sendCloseSystemWindows();
          mContext.startActivity(mHomeIntent);
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
}
Program: 23991
Project: 23991
Buggy source:
public void onKeyguardExitResult(boolean success){
  if (success) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
    sendCloseSystemWindows();
  }
}

Fixed version (ground truth):
public void onKeyguardExitResult(boolean success){
  if (success) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
}
Program: 23996
Project: 23996
Buggy source:
final void handleConfigurationChanged(Configuration config){
synchronized (mRelaunchingActivities) {
    if (mPendingConfiguration != null) {
      config=mPendingConfiguration;
      mPendingConfiguration=null;
    }
  }
  ArrayList<ComponentCallbacks> callbacks=new ArrayList<ComponentCallbacks>();
synchronized (mPackages) {
    if (mConfiguration == null) {
      mConfiguration=new Configuration();
    }
    mConfiguration.updateFrom(config);
    DisplayMetrics dm=getDisplayMetricsLocked(true);
    if (config.locale != null) {
      Locale.setDefault(config.locale);
    }
    Resources.updateSystemConfiguration(config,null);
    ApplicationContext.ApplicationPackageManager.configurationChanged();
{
      Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
      while (it.hasNext()) {
        WeakReference<Resources> v=it.next();
        Resources r=v.get();
        if (r != null) {
          r.updateConfiguration(config,dm);
        }
 else {
          it.remove();
        }
      }
    }
    callbacks=collectComponentCallbacksLocked(false,config);
  }
  final int N=callbacks.size();
  for (int i=0; i < N; i++) {
    performConfigurationChanged(callbacks.get(i),config);
  }
}

Fixed version (ground truth):
final void handleConfigurationChanged(Configuration config){
synchronized (mRelaunchingActivities) {
    if (mPendingConfiguration != null) {
      config=mPendingConfiguration;
      mPendingConfiguration=null;
    }
  }
  ArrayList<ComponentCallbacks> callbacks=new ArrayList<ComponentCallbacks>();
synchronized (mPackages) {
    if (mConfiguration == null) {
      mConfiguration=new Configuration();
    }
    mConfiguration.updateFrom(config);
    DisplayMetrics dm=getDisplayMetricsLocked(true);
    if (config.locale != null) {
      Locale.setDefault(config.locale);
    }
    Resources.updateSystemConfiguration(config,dm);
    ApplicationContext.ApplicationPackageManager.configurationChanged();
{
      Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
      while (it.hasNext()) {
        WeakReference<Resources> v=it.next();
        Resources r=v.get();
        if (r != null) {
          r.updateConfiguration(config,dm);
        }
 else {
          it.remove();
        }
      }
    }
    callbacks=collectComponentCallbacksLocked(false,config);
  }
  final int N=callbacks.size();
  for (int i=0; i < N; i++) {
    performConfigurationChanged(callbacks.get(i),config);
  }
}
Program: 23997
Project: 23997
Buggy source:
private Object responseCdmaCallWaiting(Parcel p){
  CdmaCallWaitingNotification notification=new CdmaCallWaitingNotification();
  notification.number=p.readString();
  notification.numberPresentation=p.readInt();
  notification.name=p.readString();
  notification.namePresentation=notification.numberPresentation;
  notification.isPresent=p.readInt();
  notification.signalType=p.readInt();
  notification.alertPitch=p.readInt();
  notification.signal=p.readInt();
  return notification;
}

Fixed version (ground truth):
private Object responseCdmaCallWaiting(Parcel p){
  CdmaCallWaitingNotification notification=new CdmaCallWaitingNotification();
  notification.number=p.readString();
  notification.numberPresentation=notification.presentationFromCLIP(p.readInt());
  notification.name=p.readString();
  notification.namePresentation=notification.numberPresentation;
  notification.isPresent=p.readInt();
  notification.signalType=p.readInt();
  notification.alertPitch=p.readInt();
  notification.signal=p.readInt();
  return notification;
}
Program: 23999
Project: 23999
Buggy source:
/** 
 * Create a new MotionEvent, copying from an existing one.
 */
static public MotionEvent obtain(MotionEvent o){
  MotionEvent ev=obtain();
  ev.mDeviceId=o.mDeviceId;
  ev.mEdgeFlags=o.mEdgeFlags;
  ev.mDownTime=o.mDownTime;
  ev.mEventTimeNano=o.mEventTimeNano;
  ev.mAction=o.mAction;
  ev.mNumPointers=o.mNumPointers;
  ev.mRawX=o.mRawX;
  ev.mRawY=o.mRawY;
  ev.mMetaState=o.mMetaState;
  ev.mXPrecision=o.mXPrecision;
  ev.mYPrecision=o.mYPrecision;
  final int NT=ev.mNumSamples=o.mNumSamples;
  if (ev.mTimeSamples.length < NT) {
    System.arraycopy(o.mTimeSamples,0,ev.mTimeSamples,0,NT);
  }
 else {
    ev.mTimeSamples=(long[])o.mTimeSamples.clone();
  }
  final int NS=(ev.mNumPointers=o.mNumPointers) * NT;
  if (ev.mStateSamples.length < NS) {
    System.arraycopy(o.mStateSamples,0,ev.mStateSamples,0,NS);
  }
 else {
    ev.mStateSamples=(int[])o.mStateSamples.clone();
  }
  final int ND=NS * NUM_SAMPLE_DATA;
  if (ev.mDataSamples.length < ND) {
    System.arraycopy(o.mDataSamples,0,ev.mDataSamples,0,ND);
  }
 else {
    ev.mDataSamples=(float[])o.mDataSamples.clone();
  }
  return ev;
}

Fixed version (ground truth):
/** 
 * Create a new MotionEvent, copying from an existing one.
 */
static public MotionEvent obtain(MotionEvent o){
  MotionEvent ev=obtain();
  ev.mDeviceId=o.mDeviceId;
  ev.mEdgeFlags=o.mEdgeFlags;
  ev.mDownTime=o.mDownTime;
  ev.mEventTimeNano=o.mEventTimeNano;
  ev.mAction=o.mAction;
  ev.mNumPointers=o.mNumPointers;
  ev.mRawX=o.mRawX;
  ev.mRawY=o.mRawY;
  ev.mMetaState=o.mMetaState;
  ev.mXPrecision=o.mXPrecision;
  ev.mYPrecision=o.mYPrecision;
  final int NT=ev.mNumSamples=o.mNumSamples;
  if (ev.mTimeSamples.length >= NT) {
    System.arraycopy(o.mTimeSamples,0,ev.mTimeSamples,0,NT);
  }
 else {
    ev.mTimeSamples=(long[])o.mTimeSamples.clone();
  }
  final int NS=(ev.mNumPointers=o.mNumPointers) * NT;
  if (ev.mStateSamples.length < NS) {
    System.arraycopy(o.mStateSamples,0,ev.mStateSamples,0,NS);
  }
 else {
    ev.mStateSamples=(int[])o.mStateSamples.clone();
  }
  final int ND=NS * NUM_SAMPLE_DATA;
  if (ev.mDataSamples.length < ND) {
    System.arraycopy(o.mDataSamples,0,ev.mDataSamples,0,ND);
  }
 else {
    ev.mDataSamples=(float[])o.mDataSamples.clone();
  }
  return ev;
}
Program: 24001
Project: 24001
Buggy source:
/** 
 * Stops all speech output and removes any utterances still in the queue globally.
 */
private int stopAll(String callingApp){
  int result=TextToSpeech.TTS_ERROR;
  boolean speechQueueAvailable=false;
  try {
    speechQueueAvailable=speechQueueLock.tryLock(1000,TimeUnit.MILLISECONDS);
    if (speechQueueAvailable) {
      for (int i=mSpeechQueue.size() - 1; i > -1; i--) {
        if (mSpeechQueue.get(i).mType != SpeechItem.TEXT_TO_FILE) {
          mSpeechQueue.remove(i);
        }
      }
      if ((mCurrentSpeechItem != null) && ((mCurrentSpeechItem.mType != SpeechItem.TEXT_TO_FILE) || mCurrentSpeechItem.mCallingApp.equals(callingApp))) {
        result=sNativeSynth.stop();
        mKillList.put(mCurrentSpeechItem,true);
        if (mPlayer != null) {
          try {
            mPlayer.stop();
          }
 catch (          IllegalStateException e) {
          }
        }
        mIsSpeaking=false;
        mCurrentSpeechItem=null;
      }
 else {
        result=TextToSpeech.TTS_SUCCESS;
      }
      Log.i("String_Node_Str","String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    Log.e("String_Node_Str","String_Node_Str");
    e.printStackTrace();
  }
 finally {
    if (speechQueueAvailable) {
      speechQueueLock.unlock();
    }
    return result;
  }
}

Fixed version (ground truth):
/** 
 * Stops all speech output and removes any utterances still in the queue globally.
 */
private int stopAll(String callingApp){
  int result=TextToSpeech.TTS_ERROR;
  boolean speechQueueAvailable=false;
  try {
    speechQueueAvailable=speechQueueLock.tryLock(SPEECHQUEUELOCK_TIMEOUT,TimeUnit.MILLISECONDS);
    if (speechQueueAvailable) {
      for (int i=mSpeechQueue.size() - 1; i > -1; i--) {
        if (mSpeechQueue.get(i).mType != SpeechItem.TEXT_TO_FILE) {
          mSpeechQueue.remove(i);
        }
      }
      if ((mCurrentSpeechItem != null) && ((mCurrentSpeechItem.mType != SpeechItem.TEXT_TO_FILE) || mCurrentSpeechItem.mCallingApp.equals(callingApp))) {
        result=sNativeSynth.stop();
        mKillList.put(mCurrentSpeechItem,true);
        if (mPlayer != null) {
          try {
            mPlayer.stop();
          }
 catch (          IllegalStateException e) {
          }
        }
        mIsSpeaking=false;
        mCurrentSpeechItem=null;
      }
 else {
        result=TextToSpeech.TTS_SUCCESS;
      }
      Log.i("String_Node_Str","String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    Log.e("String_Node_Str","String_Node_Str");
    e.printStackTrace();
  }
 finally {
    if (speechQueueAvailable) {
      speechQueueLock.unlock();
    }
    return result;
  }
}
Program: 24004
Project: 24004
Buggy source:
/** 
 * Recycles an event if it can be safely recycled. The condition is that no not notified service is interested in the event.
 * @param event The event.
 */
private void tryRecycleLocked(AccessibilityEvent event){
  int eventType=event.getEventType();
  List<Service> services=mServices;
  for (int i=0, count=services.size(); i < count; i++) {
    Service service=services.get(i);
    if (service.mPendingEvents.get(eventType) == event) {
      return;
    }
  }
  event.recycle();
}

Fixed version (ground truth):
/** 
 * Recycles an event if it can be safely recycled. The condition is that no not notified service is interested in the event.
 * @param event The event.
 */
private void tryRecycleLocked(AccessibilityEvent event){
  if (event == null) {
    return;
  }
  int eventType=event.getEventType();
  List<Service> services=mServices;
  for (int i=0, count=services.size(); i < count; i++) {
    Service service=services.get(i);
    if (service.mPendingEvents.get(eventType) == event) {
      return;
    }
  }
  event.recycle();
}
Program: 24005
Project: 24005
Buggy source:
/** 
 * Request the device MDN / H_SID / H_NID / MIN. "response" is const char  [0] is MDN if CDMA subscription is available [1] is H_SID (Home SID) if CDMA subscription is available [2] is H_NID (Home NID) if CDMA subscription is available [3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available
 */
public void getCDMASubscription(Message response);

Fixed version (ground truth):
/** 
 * Request the device MDN / H_SID / H_NID / MIN. "response" is const char  [0] is MDN if CDMA subscription is available [1] is H_SID (Home SID) in hexadecimal if CDMA subscription is available [2] is H_NID (Home NID) in hexadecimal if CDMA subscription is available [3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available
 */
public void getCDMASubscription(Message response);
Program: 24007
Project: 24007
Buggy source:
/** 
 * @return Whether music is being played right now.
 */
boolean isMusicActive(){
  final IAudioService audio=getAudioInterface();
  if (audio == null) {
    Log.w(TAG,"String_Node_Str");
    return false;
  }
  try {
    return audio.isMusicActive();
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + e);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * @return Whether music is being played right now.
 */
boolean isMusicActive(){
  final AudioManager am=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  if (am == null) {
    Log.w(TAG,"String_Node_Str");
    return false;
  }
  return am.isMusicActive();
}
Program: 24009
Project: 24009
Buggy source:
private void assertParse() throws Exception {
  mParcel.writeInt(kToken);
  mParcel.setDataPosition(0);
  assertTrue(mMetadata.parse(mParcel));
  assertEquals(kToken,mParcel.readInt());
}

Fixed version (ground truth):
private void assertParse() throws Exception {
  mParcel.setDataPosition(0);
  assertTrue(mMetadata.parse(mParcel));
}
Program: 24010
Project: 24010
Buggy source:
void acceptCall() throws CallStateException {
  if (ringingCall.getState() == CdmaCall.State.INCOMING) {
    Log.i("String_Node_Str","String_Node_Str");
    setMute(false);
    cm.acceptCall(obtainCompleteMessage());
  }
 else   if (ringingCall.getState() == CdmaCall.State.WAITING) {
    CdmaConnection cwConn=(CdmaConnection)(ringingCall.getLatestConnection());
    cwConn.updateParent(ringingCall,foregroundCall);
    cwConn.onConnectedInOrOut();
    switchWaitingOrHoldingAndActive();
  }
 else {
    throw new CallStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
void acceptCall() throws CallStateException {
  if (ringingCall.getState() == CdmaCall.State.INCOMING) {
    Log.i("String_Node_Str","String_Node_Str");
    setMute(false);
    cm.acceptCall(obtainCompleteMessage());
  }
 else   if (ringingCall.getState() == CdmaCall.State.WAITING) {
    CdmaConnection cwConn=(CdmaConnection)(ringingCall.getLatestConnection());
    cwConn.updateParent(ringingCall,foregroundCall);
    cwConn.onConnectedInOrOut();
    updatePhoneState();
    switchWaitingOrHoldingAndActive();
  }
 else {
    throw new CallStateException("String_Node_Str");
  }
}
Program: 24012
Project: 24012
Buggy source:
private void handleCallWaitingInfo(CdmaCallWaitingNotification cw){
  if (foregroundCall.connections.size() > 1) {
    foregroundCall.setGeneric(true);
  }
  ringingCall.setGeneric(false);
  new CdmaConnection(phone.getContext(),cw,this,ringingCall);
  notifyCallWaitingInfo(cw);
}

Fixed version (ground truth):
private void handleCallWaitingInfo(CdmaCallWaitingNotification cw){
  if (foregroundCall.connections.size() > 1) {
    foregroundCall.setGeneric(true);
  }
  ringingCall.setGeneric(false);
  new CdmaConnection(phone.getContext(),cw,this,ringingCall);
  updatePhoneState();
  notifyCallWaitingInfo(cw);
}
Program: 24013
Project: 24013
Buggy source:
private void persistVolume(VolumeStreamState streamState){
  System.putInt(mContentResolver,streamState.mVolumeIndexSettingName,streamState.mIndex);
  System.putInt(mContentResolver,streamState.mLastAudibleVolumeIndexSettingName,streamState.mLastAudibleIndex);
}

Fixed version (ground truth):
private void persistVolume(VolumeStreamState streamState){
  if (streamState.mStreamType != AudioManager.STREAM_BLUETOOTH_SCO) {
    System.putInt(mContentResolver,streamState.mVolumeIndexSettingName,streamState.mIndex);
    System.putInt(mContentResolver,streamState.mLastAudibleVolumeIndexSettingName,streamState.mLastAudibleIndex);
  }
}
Program: 24014
Project: 24014
Buggy source:
public ConfigurationInfo getDeviceConfigurationInfo(){
  ConfigurationInfo config=new ConfigurationInfo();
synchronized (this) {
    config.reqTouchScreen=mConfiguration.touchscreen;
    config.reqKeyboardType=mConfiguration.keyboard;
    config.reqNavigation=mConfiguration.navigation;
    if (mConfiguration.navigation != Configuration.NAVIGATION_NONAV) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
    }
    if (mConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
    }
  }
  return config;
}

Fixed version (ground truth):
public ConfigurationInfo getDeviceConfigurationInfo(){
  ConfigurationInfo config=new ConfigurationInfo();
synchronized (this) {
    config.reqTouchScreen=mConfiguration.touchscreen;
    config.reqKeyboardType=mConfiguration.keyboard;
    config.reqNavigation=mConfiguration.navigation;
    if (mConfiguration.navigation == Configuration.NAVIGATION_DPAD || mConfiguration.navigation == Configuration.NAVIGATION_TRACKBALL) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
    }
    if (mConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED && mConfiguration.keyboard != Configuration.KEYBOARD_NOKEYS) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
    }
  }
  return config;
}
Program: 24016
Project: 24016
Buggy source:
public ConfigurationInfo getDeviceConfigurationInfo(){
  ConfigurationInfo config=new ConfigurationInfo();
synchronized (this) {
    config.reqTouchScreen=mConfiguration.touchscreen;
    config.reqKeyboardType=mConfiguration.keyboard;
    config.reqNavigation=mConfiguration.navigation;
    if (mConfiguration.navigation != Configuration.NAVIGATION_NONAV) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
    }
    if (mConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
    }
  }
  return config;
}

Fixed version (ground truth):
public ConfigurationInfo getDeviceConfigurationInfo(){
  ConfigurationInfo config=new ConfigurationInfo();
synchronized (this) {
    config.reqTouchScreen=mConfiguration.touchscreen;
    config.reqKeyboardType=mConfiguration.keyboard;
    config.reqNavigation=mConfiguration.navigation;
    if (mConfiguration.navigation == Configuration.NAVIGATION_DPAD || mConfiguration.navigation == Configuration.NAVIGATION_TRACKBALL) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
    }
    if (mConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED && mConfiguration.keyboard != Configuration.KEYBOARD_NOKEYS) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
    }
  }
  return config;
}
Program: 24018
Project: 24018
Buggy source:
/** 
 * Converts the byte array provided to a unicode string.
 * @param b the byte array to convert to a string
 * @param includesNull determine if the byte string provided contains theUNICODE null character at the end or not; if it does, it will be removed
 * @return a Unicode string
 * @throws IllegalArgumentException if the byte array has an odd length
 */
public static String convertToUnicode(byte[] b,boolean includesNull){
  if (b == null) {
    return null;
  }
  int arrayLength=b.length;
  if (!((arrayLength % 2) == 0)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  arrayLength=(arrayLength >> 1);
  if (includesNull) {
    arrayLength-=1;
  }
  char[] c=new char[arrayLength];
  for (int i=0; i < arrayLength; i++) {
    int upper=b[2 * i];
    int lower=b[(2 * i) + 1];
    if (upper < 0) {
      upper+=256;
    }
    if (lower < 0) {
      lower+=256;
    }
    c[i]=(char)((upper << 8) | lower);
  }
  return new String(c);
}

Fixed version (ground truth):
/** 
 * Converts the byte array provided to a unicode string.
 * @param b the byte array to convert to a string
 * @param includesNull determine if the byte string provided contains theUNICODE null character at the end or not; if it does, it will be removed
 * @return a Unicode string
 * @throws IllegalArgumentException if the byte array has an odd length
 */
public static String convertToUnicode(byte[] b,boolean includesNull){
  if (b == null || b.length == 0) {
    return null;
  }
  int arrayLength=b.length;
  if (!((arrayLength % 2) == 0)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  arrayLength=(arrayLength >> 1);
  if (includesNull) {
    arrayLength-=1;
  }
  char[] c=new char[arrayLength];
  for (int i=0; i < arrayLength; i++) {
    int upper=b[2 * i];
    int lower=b[(2 * i) + 1];
    if (upper < 0) {
      upper+=256;
    }
    if (lower < 0) {
      lower+=256;
    }
    c[i]=(char)((upper << 8) | lower);
  }
  return new String(c);
}
Program: 24019
Project: 24019
Buggy source:
public void onCompletion(MediaPlayer arg0){
  String callingApp=mCurrentSpeechItem.mCallingApp;
  ArrayList<String> params=mCurrentSpeechItem.mParams;
  String utteranceId="String_Node_Str";
  if (params != null) {
    for (int i=0; i < params.size() - 1; i=i + 2) {
      String param=params.get(i);
      if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)) {
        utteranceId=params.get(i + 1);
      }
    }
  }
  if (utteranceId.length() > 0) {
    dispatchUtteranceCompletedCallback(utteranceId,callingApp);
  }
  mCurrentSpeechItem=null;
  processSpeechQueue();
}

Fixed version (ground truth):
public void onCompletion(MediaPlayer arg0){
  String callingApp=mCurrentSpeechItem.mCallingApp;
  ArrayList<String> params=mCurrentSpeechItem.mParams;
  String utteranceId="String_Node_Str";
  if (params != null) {
    for (int i=0; i < params.size() - 1; i=i + 2) {
      String param=params.get(i);
      if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)) {
        utteranceId=params.get(i + 1);
      }
    }
  }
  if (utteranceId.length() > 0) {
    dispatchUtteranceCompletedCallback(utteranceId,callingApp);
  }
  processSpeechQueue();
}