nus-yam/ex-repair huggingface dataset:
Program: 23529
Project: 23529
Buggy source:
private boolean signaturesMatch(Signature[] storedSigs,Signature[] deviceSigs){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + storedSigs + "String_Node_Str"+ deviceSigs);
  if ((storedSigs == null || storedSigs.length == 0) && (deviceSigs == null || deviceSigs.length == 0)) {
    return true;
  }
  if (storedSigs == null || deviceSigs == null) {
    return false;
  }
  int nStored=storedSigs.length;
  int nDevice=deviceSigs.length;
  for (int i=0; i < nStored; i++) {
    boolean match=false;
    for (int j=0; j < nDevice; j++) {
      if (storedSigs[i].equals(deviceSigs[j])) {
        match=true;
        break;
      }
    }
    if (!match) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean signaturesMatch(Signature[] storedSigs,PackageInfo target){
  if ((target.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + target.packageName + "String_Node_Str");
    return true;
  }
  Signature[] deviceSigs=target.signatures;
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + storedSigs + "String_Node_Str"+ deviceSigs);
  if ((storedSigs == null || storedSigs.length == 0) && (deviceSigs == null || deviceSigs.length == 0)) {
    return true;
  }
  if (storedSigs == null || deviceSigs == null) {
    return false;
  }
  int nStored=storedSigs.length;
  int nDevice=deviceSigs.length;
  for (int i=0; i < nStored; i++) {
    boolean match=false;
    for (int j=0; j < nDevice; j++) {
      if (storedSigs[i].equals(deviceSigs[j])) {
        match=true;
        break;
      }
    }
    if (!match) {
      return false;
    }
  }
  return true;
}
Program: 23530
Project: 23530
Buggy source:
private void forceUserActivityLocked(){
  boolean savedActivityAllowed=mUserActivityAllowed;
  mUserActivityAllowed=true;
  userActivity(SystemClock.uptimeMillis(),false);
  mUserActivityAllowed=savedActivityAllowed;
}

Fixed version (ground truth):
private void forceUserActivityLocked(){
  mScreenBrightness.animating=false;
  boolean savedActivityAllowed=mUserActivityAllowed;
  mUserActivityAllowed=true;
  userActivity(SystemClock.uptimeMillis(),false);
  mUserActivityAllowed=savedActivityAllowed;
}
Program: 23531
Project: 23531
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: 23532
Project: 23532
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: 23533
Project: 23533
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: 23534
Project: 23534
Buggy source:
private VolumeStreamState(String settingName,int streamType){
  mVolumeIndexSettingName=settingName;
  mLastAudibleVolumeIndexSettingName=settingName + System.APPEND_FOR_LAST_AUDIBLE;
  mStreamType=streamType;
  final ContentResolver cr=mContentResolver;
  mIndexMax=MAX_STREAM_VOLUME[streamType];
  mIndex=Settings.System.getInt(cr,mVolumeIndexSettingName,AudioManager.DEFAULT_STREAM_VOLUME[streamType]);
  mLastAudibleIndex=Settings.System.getInt(cr,mLastAudibleVolumeIndexSettingName,(mIndex > 0) ? mIndex : AudioManager.DEFAULT_STREAM_VOLUME[streamType]);
  AudioSystem.initStreamVolume(streamType,0,mIndexMax);
  mIndexMax*=10;
  mIndex=getValidIndex(10 * mIndex);
  mLastAudibleIndex=getValidIndex(10 * mLastAudibleIndex);
  setStreamVolumeIndex(streamType,mIndex);
  mDeathHandlers=new ArrayList<VolumeDeathHandler>();
}

Fixed version (ground truth):
private VolumeStreamState(String settingName,int streamType){
  setVolumeIndexSettingName(settingName);
  mStreamType=streamType;
  final ContentResolver cr=mContentResolver;
  mIndexMax=MAX_STREAM_VOLUME[streamType];
  mIndex=Settings.System.getInt(cr,mVolumeIndexSettingName,AudioManager.DEFAULT_STREAM_VOLUME[streamType]);
  mLastAudibleIndex=Settings.System.getInt(cr,mLastAudibleVolumeIndexSettingName,(mIndex > 0) ? mIndex : AudioManager.DEFAULT_STREAM_VOLUME[streamType]);
  AudioSystem.initStreamVolume(streamType,0,mIndexMax);
  mIndexMax*=10;
  mIndex=getValidIndex(10 * mIndex);
  mLastAudibleIndex=getValidIndex(10 * mLastAudibleIndex);
  setStreamVolumeIndex(streamType,mIndex);
  mDeathHandlers=new ArrayList<VolumeDeathHandler>();
}
Program: 23535
Project: 23535
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: 23536
Project: 23536
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: 23537
Project: 23537
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: 23538
Project: 23538
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: 23539
Project: 23539
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: 23540
Project: 23540
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: 23541
Project: 23541
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: 23542
Project: 23542
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: 23543
Project: 23543
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: 23544
Project: 23544
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: 23545
Project: 23545
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: 23547
Project: 23547
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: 23550
Project: 23550
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: 23551
Project: 23551
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: 23552
Project: 23552
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: 23553
Project: 23553
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: 23555
Project: 23555
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: 23556
Project: 23556
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: 23558
Project: 23558
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: 23563
Project: 23563
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: 23565
Project: 23565
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: 23568
Project: 23568
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: 23569
Project: 23569
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: 23570
Project: 23570
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");
}