nus-yam/ex-repair huggingface dataset:
Program: 182984
Project: 182984
Buggy source:
@Override public void onChange(boolean selfChange){
  super.onChange(selfChange);
synchronized (mSettingsLock) {
    int ringerModeAffectedStreams=Settings.System.getInt(mContentResolver,Settings.System.MODE_RINGER_STREAMS_AFFECTED,0);
    if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
      mRingerModeAffectedStreams=ringerModeAffectedStreams;
      setRingerModeInt(getRingerMode(),false);
    }
    int notificationsUseRingVolume=Settings.System.getInt(mContentResolver,Settings.System.NOTIFICATIONS_USE_RING_VOLUME,1);
    if (notificationsUseRingVolume != mNotificationsUseRingVolume) {
      mNotificationsUseRingVolume=notificationsUseRingVolume;
      if (mNotificationsUseRingVolume == 1) {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_RING;
      }
 else {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_NOTIFICATION;
        sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,AudioSystem.STREAM_NOTIFICATION,SENDMSG_REPLACE,0,0,mStreamStates[AudioSystem.STREAM_NOTIFICATION],PERSIST_DELAY);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onChange(boolean selfChange){
  super.onChange(selfChange);
synchronized (mSettingsLock) {
    int ringerModeAffectedStreams=Settings.System.getInt(mContentResolver,Settings.System.MODE_RINGER_STREAMS_AFFECTED,0);
    if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
      mRingerModeAffectedStreams=ringerModeAffectedStreams;
      setRingerModeInt(getRingerMode(),false);
    }
    int notificationsUseRingVolume=Settings.System.getInt(mContentResolver,Settings.System.NOTIFICATIONS_USE_RING_VOLUME,1);
    if (notificationsUseRingVolume != mNotificationsUseRingVolume) {
      mNotificationsUseRingVolume=notificationsUseRingVolume;
      if (mNotificationsUseRingVolume == 1) {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_RING;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_RING]);
      }
 else {
        STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION]=AudioSystem.STREAM_NOTIFICATION;
        mStreamStates[AudioSystem.STREAM_NOTIFICATION].setVolumeIndexSettingName(System.VOLUME_SETTINGS[AudioSystem.STREAM_NOTIFICATION]);
        sendMsg(mAudioHandler,MSG_PERSIST_VOLUME,AudioSystem.STREAM_NOTIFICATION,SENDMSG_REPLACE,0,0,mStreamStates[AudioSystem.STREAM_NOTIFICATION],0);
      }
    }
  }
}
Program: 182985
Project: 182985
Buggy source:
private void setScreenBrightnessMode(int mode){
  mAutoBrightessEnabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  mLightSensorBrightness=-1;
  if (mHasHardwareAutoBrightness) {
    mHardware.setAutoBrightness_UNCHECKED(mAutoBrightessEnabled);
    setBacklightBrightness((int)mScreenBrightness.curValue);
  }
 else {
    enableLightSensor(screenIsOn() && mAutoBrightessEnabled);
  }
}

Fixed version (ground truth):
private void setScreenBrightnessMode(int mode){
  boolean enabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  if (mAutoBrightessEnabled != enabled) {
    mAutoBrightessEnabled=enabled;
    mLightSensorBrightness=-1;
    if (mHasHardwareAutoBrightness) {
      mHardware.setAutoBrightness_UNCHECKED(enabled);
      if (screenIsOn()) {
        setBacklightBrightness((int)mScreenBrightness.curValue);
      }
    }
 else {
      enableLightSensor(screenIsOn() && enabled);
    }
  }
}
Program: 182986
Project: 182986
Buggy source:
private void setScreenBrightnessMode(int mode){
  mAutoBrightessEnabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  mLightSensorBrightness=-1;
  if (mHasHardwareAutoBrightness) {
    mHardware.setAutoBrightness_UNCHECKED(mAutoBrightessEnabled);
    setBacklightBrightness((int)mScreenBrightness.curValue);
  }
 else {
    enableLightSensor(screenIsOn() && mAutoBrightessEnabled);
  }
}

Fixed version (ground truth):
private void setScreenBrightnessMode(int mode){
  boolean enabled=(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
  if (mAutoBrightessEnabled != enabled) {
    mAutoBrightessEnabled=enabled;
    mLightSensorBrightness=-1;
    if (mHasHardwareAutoBrightness) {
      mHardware.setAutoBrightness_UNCHECKED(enabled);
      if (screenIsOn()) {
        setBacklightBrightness((int)mScreenBrightness.curValue);
      }
    }
 else {
      enableLightSensor(screenIsOn() && enabled);
    }
  }
}
Program: 182987
Project: 182987
Buggy source:
public BluetoothA2dpService(Context context,BluetoothService bluetoothService){
  mContext=context;
  mAudioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  mBluetoothService=bluetoothService;
  if (mBluetoothService == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (!initNative()) {
    throw new RuntimeException("String_Node_Str");
  }
  mAdapter=BluetoothAdapter.getDefaultAdapter();
  mIntentFilter=new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
  mContext.registerReceiver(mReceiver,mIntentFilter);
  mAudioDevices=new HashMap<BluetoothDevice,Integer>();
  if (mBluetoothService.isEnabled())   onBluetoothEnable();
  mSuspending=false;
  mResuming=false;
}

Fixed version (ground truth):
public BluetoothA2dpService(Context context,BluetoothService bluetoothService){
  mContext=context;
  mAudioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  mBluetoothService=bluetoothService;
  if (mBluetoothService == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (!initNative()) {
    throw new RuntimeException("String_Node_Str");
  }
  mAdapter=BluetoothAdapter.getDefaultAdapter();
  mIntentFilter=new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
  mContext.registerReceiver(mReceiver,mIntentFilter);
  mAudioDevices=new HashMap<BluetoothDevice,Integer>();
  if (mBluetoothService.isEnabled())   onBluetoothEnable();
  mTargetA2dpState=-1;
}
Program: 182988
Project: 182988
Buggy source:
public synchronized boolean resumeSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mResuming+ "String_Node_Str"+ mSuspending);
  if (mResuming) {
    return true;
  }
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
switch (state.intValue()) {
case BluetoothA2dp.STATE_PLAYING:
    if (mSuspending) {
      mResuming=true;
    }
  return true;
case BluetoothA2dp.STATE_CONNECTED:
mResuming=resumeSinkNative(path);
mAudioManager.setParameters("String_Node_Str");
return mResuming;
default :
return false;
}
}

Fixed version (ground truth):
public synchronized boolean resumeSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mTargetA2dpState);
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
  mTargetA2dpState=BluetoothA2dp.STATE_PLAYING;
  return checkSinkSuspendState(state.intValue());
}
Program: 182989
Project: 182989
Buggy source:
public synchronized boolean suspendSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mSuspending+ "String_Node_Str"+ mResuming);
  if (mSuspending) {
    return true;
  }
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
switch (state.intValue()) {
case BluetoothA2dp.STATE_CONNECTED:
    if (mResuming) {
      mSuspending=true;
    }
  return true;
case BluetoothA2dp.STATE_PLAYING:
mAudioManager.setParameters("String_Node_Str");
mSuspending=suspendSinkNative(path);
return mSuspending;
default :
return false;
}
}

Fixed version (ground truth):
public synchronized boolean suspendSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mTargetA2dpState);
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
  mTargetA2dpState=BluetoothA2dp.STATE_CONNECTED;
  return checkSinkSuspendState(state.intValue());
}
Program: 182990
Project: 182990
Buggy source:
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state == BluetoothA2dp.STATE_DISCONNECTED) {
    mSuspending=false;
    mResuming=false;
  }
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    if (state == BluetoothA2dp.STATE_CONNECTED && prevState == BluetoothA2dp.STATE_PLAYING) {
      if (DBG)       log("String_Node_Str" + mSuspending + "String_Node_Str"+ mResuming);
      if (mSuspending) {
        mSuspending=false;
        if (mResuming) {
          mResuming=false;
          resumeSink(device);
        }
      }
    }
    if (state == BluetoothA2dp.STATE_PLAYING && prevState == BluetoothA2dp.STATE_CONNECTED) {
      if (DBG)       log("String_Node_Str" + mSuspending + "String_Node_Str"+ mResuming);
      if (mResuming) {
        mResuming=false;
        if (mSuspending) {
          mSuspending=false;
          suspendSink(device);
        }
      }
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}

Fixed version (ground truth):
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    checkSinkSuspendState(state);
    mTargetA2dpState=-1;
    if (state == BluetoothA2dp.STATE_CONNECTING) {
      mAudioManager.setParameters("String_Node_Str");
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}
Program: 182991
Project: 182991
Buggy source:
public BluetoothA2dpService(Context context,BluetoothService bluetoothService){
  mContext=context;
  mAudioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  mBluetoothService=bluetoothService;
  if (mBluetoothService == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (!initNative()) {
    throw new RuntimeException("String_Node_Str");
  }
  mAdapter=BluetoothAdapter.getDefaultAdapter();
  mIntentFilter=new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
  mContext.registerReceiver(mReceiver,mIntentFilter);
  mAudioDevices=new HashMap<BluetoothDevice,Integer>();
  if (mBluetoothService.isEnabled())   onBluetoothEnable();
  mSuspending=false;
  mResuming=false;
}

Fixed version (ground truth):
public BluetoothA2dpService(Context context,BluetoothService bluetoothService){
  mContext=context;
  mAudioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  mBluetoothService=bluetoothService;
  if (mBluetoothService == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (!initNative()) {
    throw new RuntimeException("String_Node_Str");
  }
  mAdapter=BluetoothAdapter.getDefaultAdapter();
  mIntentFilter=new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
  mContext.registerReceiver(mReceiver,mIntentFilter);
  mAudioDevices=new HashMap<BluetoothDevice,Integer>();
  if (mBluetoothService.isEnabled())   onBluetoothEnable();
  mTargetA2dpState=-1;
}
Program: 182992
Project: 182992
Buggy source:
public synchronized boolean resumeSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mResuming+ "String_Node_Str"+ mSuspending);
  if (mResuming) {
    return true;
  }
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
switch (state.intValue()) {
case BluetoothA2dp.STATE_PLAYING:
    if (mSuspending) {
      mResuming=true;
    }
  return true;
case BluetoothA2dp.STATE_CONNECTED:
mResuming=resumeSinkNative(path);
mAudioManager.setParameters("String_Node_Str");
return mResuming;
default :
return false;
}
}

Fixed version (ground truth):
public synchronized boolean resumeSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mTargetA2dpState);
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
  mTargetA2dpState=BluetoothA2dp.STATE_PLAYING;
  return checkSinkSuspendState(state.intValue());
}
Program: 182993
Project: 182993
Buggy source:
public synchronized boolean suspendSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mSuspending+ "String_Node_Str"+ mResuming);
  if (mSuspending) {
    return true;
  }
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
switch (state.intValue()) {
case BluetoothA2dp.STATE_CONNECTED:
    if (mResuming) {
      mSuspending=true;
    }
  return true;
case BluetoothA2dp.STATE_PLAYING:
mAudioManager.setParameters("String_Node_Str");
mSuspending=suspendSinkNative(path);
return mSuspending;
default :
return false;
}
}

Fixed version (ground truth):
public synchronized boolean suspendSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mTargetA2dpState);
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
  mTargetA2dpState=BluetoothA2dp.STATE_CONNECTED;
  return checkSinkSuspendState(state.intValue());
}
Program: 182994
Project: 182994
Buggy source:
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state == BluetoothA2dp.STATE_DISCONNECTED) {
    mSuspending=false;
    mResuming=false;
  }
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    if (state == BluetoothA2dp.STATE_CONNECTED && prevState == BluetoothA2dp.STATE_PLAYING) {
      if (DBG)       log("String_Node_Str" + mSuspending + "String_Node_Str"+ mResuming);
      if (mSuspending) {
        mSuspending=false;
        if (mResuming) {
          mResuming=false;
          resumeSink(device);
        }
      }
    }
    if (state == BluetoothA2dp.STATE_PLAYING && prevState == BluetoothA2dp.STATE_CONNECTED) {
      if (DBG)       log("String_Node_Str" + mSuspending + "String_Node_Str"+ mResuming);
      if (mResuming) {
        mResuming=false;
        if (mSuspending) {
          mSuspending=false;
          suspendSink(device);
        }
      }
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}

Fixed version (ground truth):
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    checkSinkSuspendState(state);
    mTargetA2dpState=-1;
    if (state == BluetoothA2dp.STATE_CONNECTING) {
      mAudioManager.setParameters("String_Node_Str");
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}
Program: 182996
Project: 182996
Buggy source:
void buildInputMethodListLocked(ArrayList<InputMethodInfo> list,HashMap<String,InputMethodInfo> map){
  list.clear();
  map.clear();
  PackageManager pm=mContext.getPackageManager();
  List<ResolveInfo> services=pm.queryIntentServices(new Intent(InputMethod.SERVICE_INTERFACE),PackageManager.GET_META_DATA);
  for (int i=0; i < services.size(); ++i) {
    ResolveInfo ri=services.get(i);
    ServiceInfo si=ri.serviceInfo;
    ComponentName compName=new ComponentName(si.packageName,si.name);
    if (!android.Manifest.permission.BIND_INPUT_METHOD.equals(si.permission)) {
      Log.w(TAG,"String_Node_Str" + compName + "String_Node_Str"+ android.Manifest.permission.BIND_INPUT_METHOD);
      continue;
    }
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + compName);
    try {
      InputMethodInfo p=new InputMethodInfo(mContext,ri);
      list.add(p);
      map.put(p.getId(),p);
      if (DEBUG) {
        Log.d(TAG,"String_Node_Str" + p);
      }
    }
 catch (    XmlPullParserException e) {
      Log.w(TAG,"String_Node_Str" + compName,e);
    }
catch (    IOException e) {
      Log.w(TAG,"String_Node_Str" + compName,e);
    }
  }
}

Fixed version (ground truth):
void buildInputMethodListLocked(ArrayList<InputMethodInfo> list,HashMap<String,InputMethodInfo> map){
  list.clear();
  map.clear();
  PackageManager pm=mContext.getPackageManager();
  List<ResolveInfo> services=pm.queryIntentServices(new Intent(InputMethod.SERVICE_INTERFACE),PackageManager.GET_META_DATA);
  for (int i=0; i < services.size(); ++i) {
    ResolveInfo ri=services.get(i);
    ServiceInfo si=ri.serviceInfo;
    ComponentName compName=new ComponentName(si.packageName,si.name);
    if (!android.Manifest.permission.BIND_INPUT_METHOD.equals(si.permission)) {
      Log.w(TAG,"String_Node_Str" + compName + "String_Node_Str"+ android.Manifest.permission.BIND_INPUT_METHOD);
      continue;
    }
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + compName);
    try {
      InputMethodInfo p=new InputMethodInfo(mContext,ri);
      list.add(p);
      map.put(p.getId(),p);
      if (isSystemIme(p)) {
        setInputMethodEnabled(p.getId(),true);
      }
      if (DEBUG) {
        Log.d(TAG,"String_Node_Str" + p);
      }
    }
 catch (    XmlPullParserException e) {
      Log.w(TAG,"String_Node_Str" + compName,e);
    }
catch (    IOException e) {
      Log.w(TAG,"String_Node_Str" + compName,e);
    }
  }
  String defaultIme=Settings.Secure.getString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);
  if (!map.containsKey(defaultIme)) {
    if (chooseNewDefaultIME()) {
      updateFromSettingsLocked();
    }
  }
}
Program: 182999
Project: 182999
Buggy source:
private void latch(){
  if ((mFlags & COLOR) != 0) {
    makeSpace(4);
    mVtxData[mVtxCount++]=mR;
    mVtxData[mVtxCount++]=mG;
    mVtxData[mVtxCount++]=mB;
    mVtxData[mVtxCount++]=mA;
  }
  if ((mFlags & NORMAL) != 0) {
    makeSpace(3);
    mVtxData[mVtxCount++]=mNX;
    mVtxData[mVtxCount++]=mNY;
    mVtxData[mVtxCount++]=mNZ;
  }
  if ((mFlags & TEXTURE_0) != 0) {
    makeSpace(2);
    mVtxData[mVtxCount++]=mS0;
    mVtxData[mVtxCount++]=mT0;
  }
}

Fixed version (ground truth):
private void latch(){
  if ((mFlags & COLOR) != 0) {
    makeSpace(4);
    mVtxData[mVtxCount++]=mR;
    mVtxData[mVtxCount++]=mG;
    mVtxData[mVtxCount++]=mB;
    mVtxData[mVtxCount++]=mA;
  }
  if ((mFlags & TEXTURE_0) != 0) {
    makeSpace(2);
    mVtxData[mVtxCount++]=mS0;
    mVtxData[mVtxCount++]=mT0;
  }
  if ((mFlags & NORMAL) != 0) {
    makeSpace(3);
    mVtxData[mVtxCount++]=mNX;
    mVtxData[mVtxCount++]=mNY;
    mVtxData[mVtxCount++]=mNZ;
  }
}
Program: 183000
Project: 183000
Buggy source:
void prepareTracking(int y){
  mTracking=true;
  mVelocityTracker=VelocityTracker.obtain();
  boolean opening=!mExpanded;
  if (!mExpanded) {
    mAnimAccel=2000.0f;
    mAnimVel=200;
    mAnimY=mStatusBarView.getHeight();
    updateExpandedViewPos((int)mAnimY);
    mAnimating=true;
    mAnimatingReveal=true;
    mHandler.removeMessages(MSG_ANIMATE);
    mHandler.removeMessages(MSG_ANIMATE_REVEAL);
    long now=SystemClock.uptimeMillis();
    mAnimLastTime=now;
    mCurAnimationTime=now + ANIM_FRAME_DURATION;
    mAnimating=true;
    mHandler.sendMessageAtTime(mHandler.obtainMessage(MSG_ANIMATE_REVEAL),mCurAnimationTime);
  }
 else {
    if (mAnimating) {
      mAnimating=false;
      mHandler.removeMessages(MSG_ANIMATE);
    }
  }
  if (opening) {
    makeExpandedVisible();
  }
 else {
    updateExpandedViewPos(y + mViewDelta);
  }
}

Fixed version (ground truth):
void prepareTracking(int y){
  mTracking=true;
  mVelocityTracker=VelocityTracker.obtain();
  boolean opening=!mExpanded;
  if (opening) {
    mAnimAccel=2000.0f;
    mAnimVel=200;
    mAnimY=mStatusBarView.getHeight();
    updateExpandedViewPos((int)mAnimY);
    mAnimating=true;
    mAnimatingReveal=true;
    mHandler.removeMessages(MSG_ANIMATE);
    mHandler.removeMessages(MSG_ANIMATE_REVEAL);
    long now=SystemClock.uptimeMillis();
    mAnimLastTime=now;
    mCurAnimationTime=now + ANIM_FRAME_DURATION;
    mAnimating=true;
    mHandler.sendMessageAtTime(mHandler.obtainMessage(MSG_ANIMATE_REVEAL),mCurAnimationTime);
    makeExpandedVisible();
  }
 else {
    if (mAnimating) {
      mAnimating=false;
      mHandler.removeMessages(MSG_ANIMATE);
    }
    updateExpandedViewPos(y + mViewDelta);
  }
}
Program: 183001
Project: 183001
Buggy source:
void animateCollapse(){
  if (SPEW)   Log.d(TAG,"String_Node_Str" + mExpanded + "String_Node_Str"+ mExpandedVisible);
  if (!mExpandedVisible) {
    return;
  }
  prepareTracking(mDisplay.getHeight() - 1);
  performFling(mDisplay.getHeight() - 1,-2000.0f,true);
}

Fixed version (ground truth):
void animateCollapse(){
  if (SPEW) {
    Log.d(TAG,"String_Node_Str" + mExpanded + "String_Node_Str"+ mExpandedVisible+ "String_Node_Str"+ mAnimating+ "String_Node_Str"+ mAnimVel);
  }
  if (!mExpandedVisible) {
    return;
  }
  if (mAnimating) {
    return;
  }
  int y=mDisplay.getHeight() - 1;
  prepareTracking(y);
  performFling(y,-2000.0f,true);
}
Program: 183002
Project: 183002
Buggy source:
@Override public boolean dispatchKeyEvent(KeyEvent event){
  boolean down=event.getAction() == KeyEvent.ACTION_DOWN;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
    if (down) {
      StatusBarService.this.deactivate();
    }
  return true;
}
return super.dispatchKeyEvent(event);
}

Fixed version (ground truth):
@Override public boolean dispatchKeyEvent(KeyEvent event){
  boolean down=event.getAction() == KeyEvent.ACTION_DOWN;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
    if (!down) {
      StatusBarService.this.deactivate();
    }
  return true;
}
return super.dispatchKeyEvent(event);
}
Program: 183004
Project: 183004
Buggy source:
final void completeRemoveProvider(IContentProvider provider){
  IBinder jBinder=provider.asBinder();
synchronized (mProviderMap) {
    ProviderRefCount prc=mProviderRefCountMap.get(jBinder);
    if (prc != null && prc.count == 0) {
      mProviderRefCountMap.remove(jBinder);
      removeProviderLocked(provider);
    }
  }
}

Fixed version (ground truth):
final void completeRemoveProvider(IContentProvider provider){
  IBinder jBinder=provider.asBinder();
  String name=null;
synchronized (mProviderMap) {
    ProviderRefCount prc=mProviderRefCountMap.get(jBinder);
    if (prc != null && prc.count == 0) {
      mProviderRefCountMap.remove(jBinder);
      name=removeProviderLocked(provider);
    }
  }
  if (name != null) {
    try {
      if (localLOGV)       Log.v(TAG,"String_Node_Str" + "String_Node_Str" + name);
      ActivityManagerNative.getDefault().removeContentProvider(getApplicationThread(),name);
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 183005
Project: 183005
Buggy source:
public final void removeProviderLocked(IContentProvider provider){
  if (provider == null) {
    return;
  }
  IBinder providerBinder=provider.asBinder();
  boolean amRemoveFlag=false;
  Iterator<ProviderRecord> iter=mProviderMap.values().iterator();
  while (iter.hasNext()) {
    ProviderRecord pr=iter.next();
    IBinder myBinder=pr.mProvider.asBinder();
    if (myBinder == providerBinder) {
      if (pr.mLocalProvider != null) {
        if (localLOGV)         Log.i(TAG,"String_Node_Str");
        return;
      }
      if (localLOGV)       Log.v(TAG,"String_Node_Str" + "String_Node_Str");
      myBinder.unlinkToDeath(pr,0);
      iter.remove();
      if (!amRemoveFlag) {
        try {
          if (localLOGV)           Log.v(TAG,"String_Node_Str" + "String_Node_Str" + pr.mName);
          ActivityManagerNative.getDefault().removeContentProvider(getApplicationThread(),pr.mName);
          amRemoveFlag=true;
        }
 catch (        RemoteException e) {
        }
      }
    }
  }
}

Fixed version (ground truth):
public final String removeProviderLocked(IContentProvider provider){
  if (provider == null) {
    return null;
  }
  IBinder providerBinder=provider.asBinder();
  String name=null;
  Iterator<ProviderRecord> iter=mProviderMap.values().iterator();
  while (iter.hasNext()) {
    ProviderRecord pr=iter.next();
    IBinder myBinder=pr.mProvider.asBinder();
    if (myBinder == providerBinder) {
      if (pr.mLocalProvider != null) {
        if (localLOGV)         Log.i(TAG,"String_Node_Str");
        return name;
      }
      if (localLOGV)       Log.v(TAG,"String_Node_Str" + "String_Node_Str");
      myBinder.unlinkToDeath(pr,0);
      iter.remove();
      if (name == null) {
        name=pr.mName;
      }
    }
  }
  return name;
}
Program: 183007
Project: 183007
Buggy source:
/** 
 * Drop a content provider from a ProcessRecord's bookkeeping
 * @param cpr
 */
public void removeContentProvider(IApplicationThread caller,String name){
synchronized (this) {
    ContentProviderRecord cpr=(ContentProviderRecord)mProvidersByName.get(name);
    if (cpr == null) {
      if (DEBUG_PROVIDER)       Log.v(TAG,name + "String_Node_Str");
      return;
    }
    final ProcessRecord r=getRecordForAppLocked(caller);
    if (r == null) {
      throw new SecurityException("String_Node_Str" + caller + "String_Node_Str"+ name);
    }
    ContentProviderRecord localCpr=(ContentProviderRecord)mProvidersByClass.get(cpr.info.name);
    if (DEBUG_PROVIDER)     Log.v(TAG,"String_Node_Str" + r.info.processName + "String_Node_Str"+ localCpr.appInfo.processName);
    if (localCpr.app == r) {
      Log.w(TAG,"String_Node_Str" + cpr.info.name + "String_Node_Str"+ r.processName);
      return;
    }
 else {
      localCpr.clients.remove(r);
      r.conProviders.remove(localCpr);
    }
    updateOomAdjLocked();
  }
}

Fixed version (ground truth):
/** 
 * Drop a content provider from a ProcessRecord's bookkeeping
 * @param cpr
 */
public void removeContentProvider(IApplicationThread caller,String name){
synchronized (this) {
    ContentProviderRecord cpr=(ContentProviderRecord)mProvidersByName.get(name);
    if (cpr == null) {
      if (DEBUG_PROVIDER)       Log.v(TAG,name + "String_Node_Str");
      return;
    }
    final ProcessRecord r=getRecordForAppLocked(caller);
    if (r == null) {
      throw new SecurityException("String_Node_Str" + caller + "String_Node_Str"+ name);
    }
    ContentProviderRecord localCpr=(ContentProviderRecord)mProvidersByClass.get(cpr.info.name);
    if (DEBUG_PROVIDER)     Log.v(TAG,"String_Node_Str" + r.info.processName + "String_Node_Str"+ localCpr.appInfo.processName);
    if (localCpr.app == r) {
      Log.w(TAG,"String_Node_Str" + cpr.info.name + "String_Node_Str"+ r.processName);
      return;
    }
 else {
      Integer cnt=r.conProviders.get(localCpr);
      if (cnt == null || cnt.intValue() <= 1) {
        localCpr.clients.remove(r);
        r.conProviders.remove(localCpr);
      }
 else {
        r.conProviders.put(localCpr,new Integer(cnt.intValue() - 1));
      }
    }
    updateOomAdjLocked();
  }
}
Program: 183011
Project: 183011
Buggy source:
void setTargetLocked(int target,int stepsToTarget,int initialValue,int nominalCurrentValue){
  if (!initialized) {
    initialized=true;
    curValue=(float)initialValue;
  }
  targetValue=target;
  delta=(targetValue - (nominalCurrentValue >= 0 ? nominalCurrentValue : curValue)) / stepsToTarget;
  if (mSpew) {
    String noticeMe=nominalCurrentValue == curValue ? "String_Node_Str" : "String_Node_Str";
    Log.i(TAG,"String_Node_Str" + mask + "String_Node_Str"+ curValue+ "String_Node_Str"+ targetValue+ "String_Node_Str"+ delta+ "String_Node_Str"+ nominalCurrentValue+ noticeMe);
  }
  animating=true;
}

Fixed version (ground truth):
boolean setTargetLocked(int target,int stepsToTarget,int initialValue,int nominalCurrentValue){
  if (!initialized) {
    initialized=true;
    curValue=(float)initialValue;
  }
 else   if (targetValue == target) {
    return false;
  }
  targetValue=target;
  delta=(targetValue - (nominalCurrentValue >= 0 ? nominalCurrentValue : curValue)) / stepsToTarget;
  if (mSpew) {
    String noticeMe=nominalCurrentValue == curValue ? "String_Node_Str" : "String_Node_Str";
    Log.i(TAG,"String_Node_Str" + mask + "String_Node_Str"+ curValue+ "String_Node_Str"+ targetValue+ "String_Node_Str"+ delta+ "String_Node_Str"+ nominalCurrentValue+ noticeMe);
  }
  animating=true;
  return true;
}
Program: 183014
Project: 183014
Buggy source:
private final boolean bringUpServiceLocked(ServiceRecord r,int intentFlags,boolean whileRestarting){
  if (r.app != null) {
    sendServiceArgsLocked(r,false);
    return true;
  }
  if (!whileRestarting && r.restartDelay > 0) {
    return true;
  }
  if (DEBUG_SERVICE)   Log.v(TAG,"String_Node_Str" + r.name + "String_Node_Str"+ r.intent);
  mRestartingServices.remove(r);
  final String appName=r.processName;
  ProcessRecord app=getProcessRecordLocked(appName,r.appInfo.uid);
  if (app != null && app.thread != null) {
    try {
      realStartServiceLocked(r,app);
      return true;
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str" + r.shortName,e);
    }
  }
  if (!mPendingServices.contains(r)) {
    if (startProcessLocked(appName,r.appInfo,true,intentFlags,"String_Node_Str",r.name,false) == null) {
      Log.w(TAG,"String_Node_Str" + r.appInfo.packageName + "String_Node_Str"+ r.appInfo.uid+ "String_Node_Str"+ r.intent.getIntent()+ "String_Node_Str");
      bringDownServiceLocked(r,true);
      return false;
    }
    mPendingServices.add(r);
  }
  return true;
}

Fixed version (ground truth):
private final boolean bringUpServiceLocked(ServiceRecord r,int intentFlags,boolean whileRestarting){
  if (r.app != null && r.app.thread != null) {
    sendServiceArgsLocked(r,false);
    return true;
  }
  if (!whileRestarting && r.restartDelay > 0) {
    return true;
  }
  if (DEBUG_SERVICE)   Log.v(TAG,"String_Node_Str" + r.name + "String_Node_Str"+ r.intent);
  mRestartingServices.remove(r);
  final String appName=r.processName;
  ProcessRecord app=getProcessRecordLocked(appName,r.appInfo.uid);
  if (app != null && app.thread != null) {
    try {
      realStartServiceLocked(r,app);
      return true;
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str" + r.shortName,e);
    }
  }
  if (startProcessLocked(appName,r.appInfo,true,intentFlags,"String_Node_Str",r.name,false) == null) {
    Log.w(TAG,"String_Node_Str" + r.appInfo.packageName + "String_Node_Str"+ r.appInfo.uid+ "String_Node_Str"+ r.intent.getIntent()+ "String_Node_Str");
    bringDownServiceLocked(r,true);
    return false;
  }
  if (!mPendingServices.contains(r)) {
    mPendingServices.add(r);
  }
  return true;
}
Program: 183017
Project: 183017
Buggy source:
public BluetoothA2dpService(Context context,BluetoothService bluetoothService){
  mContext=context;
  mAudioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  mBluetoothService=bluetoothService;
  if (mBluetoothService == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (!initNative()) {
    throw new RuntimeException("String_Node_Str");
  }
  mAdapter=BluetoothAdapter.getDefaultAdapter();
  mIntentFilter=new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
  mContext.registerReceiver(mReceiver,mIntentFilter);
  mAudioDevices=new HashMap<BluetoothDevice,Integer>();
  if (mBluetoothService.isEnabled())   onBluetoothEnable();
}

Fixed version (ground truth):
public BluetoothA2dpService(Context context,BluetoothService bluetoothService){
  mContext=context;
  mAudioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  mBluetoothService=bluetoothService;
  if (mBluetoothService == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (!initNative()) {
    throw new RuntimeException("String_Node_Str");
  }
  mAdapter=BluetoothAdapter.getDefaultAdapter();
  mIntentFilter=new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
  mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
  mContext.registerReceiver(mReceiver,mIntentFilter);
  mAudioDevices=new HashMap<BluetoothDevice,Integer>();
  if (mBluetoothService.isEnabled())   onBluetoothEnable();
  mSuspending=false;
  mResuming=false;
}
Program: 183018
Project: 183018
Buggy source:
public synchronized boolean resumeSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str");
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
switch (state.intValue()) {
case BluetoothA2dp.STATE_PLAYING:
    return true;
case BluetoothA2dp.STATE_CONNECTED:
  return resumeSinkNative(path);
default :
return false;
}
}

Fixed version (ground truth):
public synchronized boolean resumeSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mResuming+ "String_Node_Str"+ mSuspending);
  if (mResuming) {
    return true;
  }
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
switch (state.intValue()) {
case BluetoothA2dp.STATE_PLAYING:
    if (mSuspending) {
      mResuming=true;
    }
  return true;
case BluetoothA2dp.STATE_CONNECTED:
mResuming=resumeSinkNative(path);
mAudioManager.setParameters("String_Node_Str");
return mResuming;
default :
return false;
}
}
Program: 183019
Project: 183019
Buggy source:
private synchronized void onBluetoothEnable(){
  String devices=mBluetoothService.getProperty("String_Node_Str");
  mSinkCount=0;
  if (devices != null) {
    String[] paths=devices.split("String_Node_Str");
    for (    String path : paths) {
      String address=mBluetoothService.getAddressFromObjectPath(path);
      BluetoothDevice device=mAdapter.getRemoteDevice(address);
      ParcelUuid[] remoteUuids=mBluetoothService.getRemoteUuids(address);
      if (remoteUuids != null)       if (BluetoothUuid.containsAnyUuid(remoteUuids,new ParcelUuid[]{BluetoothUuid.AudioSink,BluetoothUuid.AdvAudioDist})) {
        addAudioSink(device);
      }
    }
  }
  mAudioManager.setParameters(BLUETOOTH_ENABLED + "String_Node_Str");
}

Fixed version (ground truth):
private synchronized void onBluetoothEnable(){
  String devices=mBluetoothService.getProperty("String_Node_Str");
  mSinkCount=0;
  if (devices != null) {
    String[] paths=devices.split("String_Node_Str");
    for (    String path : paths) {
      String address=mBluetoothService.getAddressFromObjectPath(path);
      BluetoothDevice device=mAdapter.getRemoteDevice(address);
      ParcelUuid[] remoteUuids=mBluetoothService.getRemoteUuids(address);
      if (remoteUuids != null)       if (BluetoothUuid.containsAnyUuid(remoteUuids,new ParcelUuid[]{BluetoothUuid.AudioSink,BluetoothUuid.AdvAudioDist})) {
        addAudioSink(device);
      }
    }
  }
  mAudioManager.setParameters(BLUETOOTH_ENABLED + "String_Node_Str");
  mAudioManager.setParameters("String_Node_Str");
}
Program: 183020
Project: 183020
Buggy source:
public synchronized boolean suspendSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str");
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
switch (state.intValue()) {
case BluetoothA2dp.STATE_CONNECTED:
    return true;
case BluetoothA2dp.STATE_PLAYING:
  return suspendSinkNative(path);
default :
return false;
}
}

Fixed version (ground truth):
public synchronized boolean suspendSink(BluetoothDevice device){
  mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,"String_Node_Str");
  if (DBG)   log("String_Node_Str" + device + "String_Node_Str"+ mSuspending+ "String_Node_Str"+ mResuming);
  if (mSuspending) {
    return true;
  }
  if (device == null || mAudioDevices == null) {
    return false;
  }
  String path=mBluetoothService.getObjectPathFromAddress(device.getAddress());
  Integer state=mAudioDevices.get(device);
  if (path == null || state == null) {
    return false;
  }
switch (state.intValue()) {
case BluetoothA2dp.STATE_CONNECTED:
    if (mResuming) {
      mSuspending=true;
    }
  return true;
case BluetoothA2dp.STATE_PLAYING:
mAudioManager.setParameters("String_Node_Str");
mSuspending=suspendSinkNative(path);
return mSuspending;
default :
return false;
}
}
Program: 183021
Project: 183021
Buggy source:
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}

Fixed version (ground truth):
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state == BluetoothA2dp.STATE_DISCONNECTED) {
    mSuspending=false;
    mResuming=false;
  }
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    if (state == BluetoothA2dp.STATE_CONNECTED && prevState == BluetoothA2dp.STATE_PLAYING) {
      if (DBG)       log("String_Node_Str" + mSuspending + "String_Node_Str"+ mResuming);
      if (mSuspending) {
        mSuspending=false;
        if (mResuming) {
          mResuming=false;
          resumeSink(device);
        }
      }
    }
    if (state == BluetoothA2dp.STATE_PLAYING && prevState == BluetoothA2dp.STATE_CONNECTED) {
      if (DBG)       log("String_Node_Str" + mSuspending + "String_Node_Str"+ mResuming);
      if (mResuming) {
        mResuming=false;
        if (mSuspending) {
          mSuspending=false;
          suspendSink(device);
        }
      }
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}
Program: 183023
Project: 183023
Buggy source:
/** 
 * Re-enable mobile data connectivity after a   {@link #teardown()}.
 */
public boolean reconnect(){
  setTeardownRequested(false);
switch (setEnableApn(mApnType,true)) {
case Phone.APN_ALREADY_ACTIVE:
    mEnabled=true;
  mMobileDataState=Phone.DataState.CONNECTING;
setDetailedState(DetailedState.CONNECTING,Phone.REASON_APN_CHANGED,null);
Intent intent=new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(Phone.STATE_KEY,Phone.DataState.CONNECTED.toString());
intent.putExtra(Phone.STATE_CHANGE_REASON_KEY,Phone.REASON_APN_CHANGED);
intent.putExtra(Phone.DATA_APN_TYPES_KEY,mApnType);
intent.putExtra(Phone.DATA_IFACE_NAME_KEY,mInterfaceName);
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY,false);
if (mStateReceiver != null) mStateReceiver.onReceive(mContext,intent);
break;
case Phone.APN_REQUEST_STARTED:
mEnabled=true;
break;
case Phone.APN_REQUEST_FAILED:
if (mPhoneService == null && mApnType == Phone.APN_TYPE_DEFAULT) {
return false;
}
case Phone.APN_TYPE_NOT_AVAILABLE:
mEnabled=false;
break;
default :
Log.e(TAG,"String_Node_Str");
mEnabled=false;
break;
}
return mEnabled;
}

Fixed version (ground truth):
/** 
 * Re-enable mobile data connectivity after a   {@link #teardown()}.
 */
public boolean reconnect(){
  setTeardownRequested(false);
switch (setEnableApn(mApnType,true)) {
case Phone.APN_ALREADY_ACTIVE:
    mEnabled=true;
  mMobileDataState=Phone.DataState.CONNECTING;
setDetailedState(DetailedState.CONNECTING,Phone.REASON_APN_CHANGED,null);
Intent intent=new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(Phone.STATE_KEY,Phone.DataState.CONNECTED.toString());
intent.putExtra(Phone.STATE_CHANGE_REASON_KEY,Phone.REASON_APN_CHANGED);
intent.putExtra(Phone.DATA_APN_TYPES_KEY,mApnType);
intent.putExtra(Phone.DATA_APN_KEY,mApnName);
intent.putExtra(Phone.DATA_IFACE_NAME_KEY,mInterfaceName);
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY,false);
if (mStateReceiver != null) mStateReceiver.onReceive(mContext,intent);
break;
case Phone.APN_REQUEST_STARTED:
mEnabled=true;
break;
case Phone.APN_REQUEST_FAILED:
if (mPhoneService == null && mApnType == Phone.APN_TYPE_DEFAULT) {
return false;
}
case Phone.APN_TYPE_NOT_AVAILABLE:
mEnabled=false;
break;
default :
Log.e(TAG,"String_Node_Str");
mEnabled=false;
break;
}
return mEnabled;
}