nus-yam/ex-repair huggingface dataset:
Program: 23571
Project: 23571
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: 23572
Project: 23572
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: 23574
Project: 23574
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;
}
Program: 23575
Project: 23575
Buggy source:
private static void beginShutdownSequence(Context context){
synchronized (sIsStartedGuard) {
    sIsStarted=true;
  }
  ProgressDialog pd=new ProgressDialog(context);
  pd.setTitle(context.getText(com.android.internal.R.string.power_off));
  pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
  pd.setIndeterminate(true);
  pd.setCancelable(false);
  pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  pd.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  pd.show();
  sInstance.mContext=context;
  sInstance.mHandler=new Handler(){
  }
;
  sInstance.start();
}

Fixed version (ground truth):
private static void beginShutdownSequence(Context context){
synchronized (sIsStartedGuard) {
    sIsStarted=true;
  }
  ProgressDialog pd=new ProgressDialog(context);
  pd.setTitle(context.getText(com.android.internal.R.string.power_off));
  pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
  pd.setIndeterminate(true);
  pd.setCancelable(false);
  pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  if (!context.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
    pd.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  pd.show();
  sInstance.mContext=context;
  sInstance.mHandler=new Handler(){
  }
;
  sInstance.start();
}
Program: 23576
Project: 23576
Buggy source:
/** 
 * Request a clean shutdown, waiting for subsystems to clean up their state etc.  Must be called from a Looper thread in which its UI is shown.
 * @param context Context used to display the shutdown progress dialog.
 */
public static void shutdown(final Context context,boolean confirm){
synchronized (sIsStartedGuard) {
    if (sIsStarted) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
  }
  Log.d(TAG,"String_Node_Str");
  if (confirm) {
    final AlertDialog dialog=new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_alert).setTitle(com.android.internal.R.string.power_off).setMessage(com.android.internal.R.string.shutdown_confirm).setPositiveButton(com.android.internal.R.string.yes,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        beginShutdownSequence(context);
      }
    }
).setNegativeButton(com.android.internal.R.string.no,null).create();
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    dialog.show();
  }
 else {
    beginShutdownSequence(context);
  }
}

Fixed version (ground truth):
/** 
 * Request a clean shutdown, waiting for subsystems to clean up their state etc.  Must be called from a Looper thread in which its UI is shown.
 * @param context Context used to display the shutdown progress dialog.
 */
public static void shutdown(final Context context,boolean confirm){
synchronized (sIsStartedGuard) {
    if (sIsStarted) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
  }
  Log.d(TAG,"String_Node_Str");
  if (confirm) {
    final AlertDialog dialog=new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_alert).setTitle(com.android.internal.R.string.power_off).setMessage(com.android.internal.R.string.shutdown_confirm).setPositiveButton(com.android.internal.R.string.yes,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        beginShutdownSequence(context);
      }
    }
).setNegativeButton(com.android.internal.R.string.no,null).create();
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    if (!context.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
      dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    }
    dialog.show();
  }
 else {
    beginShutdownSequence(context);
  }
}
Program: 23577
Project: 23577
Buggy source:
private Dialog getProgressDialog(){
  if (mCheckingDialog == null) {
    mCheckingDialog=new ProgressDialog(mContext);
    mCheckingDialog.setMessage(mContext.getString(R.string.lockscreen_glogin_checking_password));
    mCheckingDialog.setIndeterminate(true);
    mCheckingDialog.setCancelable(false);
    mCheckingDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    mCheckingDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  return mCheckingDialog;
}

Fixed version (ground truth):
private Dialog getProgressDialog(){
  if (mCheckingDialog == null) {
    mCheckingDialog=new ProgressDialog(mContext);
    mCheckingDialog.setMessage(mContext.getString(R.string.lockscreen_glogin_checking_password));
    mCheckingDialog.setIndeterminate(true);
    mCheckingDialog.setCancelable(false);
    mCheckingDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    if (!mContext.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
      mCheckingDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    }
  }
  return mCheckingDialog;
}
Program: 23579
Project: 23579
Buggy source:
private void showAlmostAtAccountLoginDialog(){
  int timeoutInSeconds=(int)LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
  String message=mContext.getString(R.string.lockscreen_failed_attempts_almost_glogin,LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT,LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT,timeoutInSeconds);
  final AlertDialog dialog=new AlertDialog.Builder(mContext).setTitle(null).setMessage(message).setNeutralButton(R.string.ok,null).create();
  dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  dialog.show();
}

Fixed version (ground truth):
private void showAlmostAtAccountLoginDialog(){
  int timeoutInSeconds=(int)LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
  String message=mContext.getString(R.string.lockscreen_failed_attempts_almost_glogin,LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT,LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT,timeoutInSeconds);
  final AlertDialog dialog=new AlertDialog.Builder(mContext).setTitle(null).setMessage(message).setNeutralButton(R.string.ok,null).create();
  dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  if (!mContext.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  dialog.show();
}
Program: 23580
Project: 23580
Buggy source:
private void showTimeoutDialog(){
  int timeoutInSeconds=(int)LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
  String message=mContext.getString(R.string.lockscreen_too_many_failed_attempts_dialog_message,mUpdateMonitor.getFailedAttempts(),timeoutInSeconds);
  final AlertDialog dialog=new AlertDialog.Builder(mContext).setTitle(null).setMessage(message).setNeutralButton(R.string.ok,null).create();
  dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  dialog.show();
}

Fixed version (ground truth):
private void showTimeoutDialog(){
  int timeoutInSeconds=(int)LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
  String message=mContext.getString(R.string.lockscreen_too_many_failed_attempts_dialog_message,mUpdateMonitor.getFailedAttempts(),timeoutInSeconds);
  final AlertDialog dialog=new AlertDialog.Builder(mContext).setTitle(null).setMessage(message).setNeutralButton(R.string.ok,null).create();
  dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  if (!mContext.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  dialog.show();
}
Program: 23582
Project: 23582
Buggy source:
private Dialog getSimUnlockProgressDialog(){
  if (mSimUnlockProgressDialog == null) {
    mSimUnlockProgressDialog=new ProgressDialog(mContext);
    mSimUnlockProgressDialog.setMessage(mContext.getString(R.string.lockscreen_sim_unlock_progress_dialog_message));
    mSimUnlockProgressDialog.setIndeterminate(true);
    mSimUnlockProgressDialog.setCancelable(false);
    mSimUnlockProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    mSimUnlockProgressDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  return mSimUnlockProgressDialog;
}

Fixed version (ground truth):
private Dialog getSimUnlockProgressDialog(){
  if (mSimUnlockProgressDialog == null) {
    mSimUnlockProgressDialog=new ProgressDialog(mContext);
    mSimUnlockProgressDialog.setMessage(mContext.getString(R.string.lockscreen_sim_unlock_progress_dialog_message));
    mSimUnlockProgressDialog.setIndeterminate(true);
    mSimUnlockProgressDialog.setCancelable(false);
    mSimUnlockProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    if (!mContext.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
      mSimUnlockProgressDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    }
  }
  return mSimUnlockProgressDialog;
}
Program: 23583
Project: 23583
Buggy source:
private static void beginShutdownSequence(Context context){
synchronized (sIsStartedGuard) {
    sIsStarted=true;
  }
  ProgressDialog pd=new ProgressDialog(context);
  pd.setTitle(context.getText(com.android.internal.R.string.power_off));
  pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
  pd.setIndeterminate(true);
  pd.setCancelable(false);
  pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  pd.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  pd.show();
  sInstance.mContext=context;
  sInstance.mHandler=new Handler(){
  }
;
  sInstance.start();
}

Fixed version (ground truth):
private static void beginShutdownSequence(Context context){
synchronized (sIsStartedGuard) {
    sIsStarted=true;
  }
  ProgressDialog pd=new ProgressDialog(context);
  pd.setTitle(context.getText(com.android.internal.R.string.power_off));
  pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
  pd.setIndeterminate(true);
  pd.setCancelable(false);
  pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  if (!context.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
    pd.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  pd.show();
  sInstance.mContext=context;
  sInstance.mHandler=new Handler(){
  }
;
  sInstance.start();
}
Program: 23584
Project: 23584
Buggy source:
/** 
 * Request a clean shutdown, waiting for subsystems to clean up their state etc.  Must be called from a Looper thread in which its UI is shown.
 * @param context Context used to display the shutdown progress dialog.
 */
public static void shutdown(final Context context,boolean confirm){
synchronized (sIsStartedGuard) {
    if (sIsStarted) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
  }
  Log.d(TAG,"String_Node_Str");
  if (confirm) {
    final AlertDialog dialog=new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_alert).setTitle(com.android.internal.R.string.power_off).setMessage(com.android.internal.R.string.shutdown_confirm).setPositiveButton(com.android.internal.R.string.yes,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        beginShutdownSequence(context);
      }
    }
).setNegativeButton(com.android.internal.R.string.no,null).create();
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    dialog.show();
  }
 else {
    beginShutdownSequence(context);
  }
}

Fixed version (ground truth):
/** 
 * Request a clean shutdown, waiting for subsystems to clean up their state etc.  Must be called from a Looper thread in which its UI is shown.
 * @param context Context used to display the shutdown progress dialog.
 */
public static void shutdown(final Context context,boolean confirm){
synchronized (sIsStartedGuard) {
    if (sIsStarted) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
  }
  Log.d(TAG,"String_Node_Str");
  if (confirm) {
    final AlertDialog dialog=new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_alert).setTitle(com.android.internal.R.string.power_off).setMessage(com.android.internal.R.string.shutdown_confirm).setPositiveButton(com.android.internal.R.string.yes,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        beginShutdownSequence(context);
      }
    }
).setNegativeButton(com.android.internal.R.string.no,null).create();
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    if (!context.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
      dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    }
    dialog.show();
  }
 else {
    beginShutdownSequence(context);
  }
}
Program: 23585
Project: 23585
Buggy source:
private static void beginShutdownSequence(Context context){
synchronized (sIsStartedGuard) {
    sIsStarted=true;
  }
  ProgressDialog pd=new ProgressDialog(context);
  pd.setTitle(context.getText(com.android.internal.R.string.power_off));
  pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
  pd.setIndeterminate(true);
  pd.setCancelable(false);
  pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  pd.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  pd.show();
  sInstance.mContext=context;
  sInstance.mHandler=new Handler(){
  }
;
  sInstance.start();
}

Fixed version (ground truth):
private static void beginShutdownSequence(Context context){
synchronized (sIsStartedGuard) {
    sIsStarted=true;
  }
  ProgressDialog pd=new ProgressDialog(context);
  pd.setTitle(context.getText(com.android.internal.R.string.power_off));
  pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
  pd.setIndeterminate(true);
  pd.setCancelable(false);
  pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  if (!context.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
    pd.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  pd.show();
  sInstance.mContext=context;
  sInstance.mHandler=new Handler(){
  }
;
  sInstance.start();
}
Program: 23586
Project: 23586
Buggy source:
/** 
 * Request a clean shutdown, waiting for subsystems to clean up their state etc.  Must be called from a Looper thread in which its UI is shown.
 * @param context Context used to display the shutdown progress dialog.
 */
public static void shutdown(final Context context,boolean confirm){
synchronized (sIsStartedGuard) {
    if (sIsStarted) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
  }
  Log.d(TAG,"String_Node_Str");
  if (confirm) {
    final AlertDialog dialog=new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_alert).setTitle(com.android.internal.R.string.power_off).setMessage(com.android.internal.R.string.shutdown_confirm).setPositiveButton(com.android.internal.R.string.yes,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        beginShutdownSequence(context);
      }
    }
).setNegativeButton(com.android.internal.R.string.no,null).create();
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    dialog.show();
  }
 else {
    beginShutdownSequence(context);
  }
}

Fixed version (ground truth):
/** 
 * Request a clean shutdown, waiting for subsystems to clean up their state etc.  Must be called from a Looper thread in which its UI is shown.
 * @param context Context used to display the shutdown progress dialog.
 */
public static void shutdown(final Context context,boolean confirm){
synchronized (sIsStartedGuard) {
    if (sIsStarted) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
  }
  Log.d(TAG,"String_Node_Str");
  if (confirm) {
    final AlertDialog dialog=new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_alert).setTitle(com.android.internal.R.string.power_off).setMessage(com.android.internal.R.string.shutdown_confirm).setPositiveButton(com.android.internal.R.string.yes,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        beginShutdownSequence(context);
      }
    }
).setNegativeButton(com.android.internal.R.string.no,null).create();
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    if (!context.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
      dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    }
    dialog.show();
  }
 else {
    beginShutdownSequence(context);
  }
}
Program: 23587
Project: 23587
Buggy source:
void updatePlugged(){
  Intent powerIntent=mContext.registerReceiver(null,mBatteryStatusFilter);
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + powerIntent.getExtras());
  if (powerIntent != null) {
    mPlugged=powerIntent.getIntExtra(BatteryManager.EXTRA_PLUGGED,0);
    if (localLOGV)     Log.v(TAG,"String_Node_Str" + mPlugged);
  }
}

Fixed version (ground truth):
void updatePlugged(Intent powerIntent){
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + powerIntent.getExtras());
  if (powerIntent != null) {
    mPlugged=powerIntent.getIntExtra(BatteryManager.EXTRA_PLUGGED,0);
    if (localLOGV)     Log.v(TAG,"String_Node_Str" + mPlugged);
  }
}
Program: 23589
Project: 23589
Buggy source:
public void onReceive(Context context,Intent intent){
  mDockState=intent.getIntExtra(Intent.EXTRA_DOCK_STATE,Intent.EXTRA_DOCK_STATE_UNDOCKED);
  updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
  updateKeepScreenOn();
  updateOrientationListenerLp();
}

Fixed version (ground truth):
public void onReceive(Context context,Intent intent){
  mDockState=intent.getIntExtra(Intent.EXTRA_DOCK_STATE,Intent.EXTRA_DOCK_STATE_UNDOCKED);
  boolean watchBattery=mDockState != Intent.EXTRA_DOCK_STATE_UNDOCKED;
  if (watchBattery != mRegisteredBatteryReceiver) {
    mRegisteredBatteryReceiver=watchBattery;
    if (watchBattery) {
      updatePlugged(mContext.registerReceiver(mBatteryReceiver,mBatteryStatusFilter));
    }
 else {
      mContext.unregisterReceiver(mBatteryReceiver);
    }
  }
  updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
  updateDockKeepingScreenOn();
  updateOrientationListenerLp();
}
Program: 23590
Project: 23590
Buggy source:
private Dialog getProgressDialog(){
  if (mCheckingDialog == null) {
    mCheckingDialog=new ProgressDialog(mContext);
    mCheckingDialog.setMessage(mContext.getString(R.string.lockscreen_glogin_checking_password));
    mCheckingDialog.setIndeterminate(true);
    mCheckingDialog.setCancelable(false);
    mCheckingDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    mCheckingDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  return mCheckingDialog;
}

Fixed version (ground truth):
private Dialog getProgressDialog(){
  if (mCheckingDialog == null) {
    mCheckingDialog=new ProgressDialog(mContext);
    mCheckingDialog.setMessage(mContext.getString(R.string.lockscreen_glogin_checking_password));
    mCheckingDialog.setIndeterminate(true);
    mCheckingDialog.setCancelable(false);
    mCheckingDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    if (!mContext.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
      mCheckingDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    }
  }
  return mCheckingDialog;
}
Program: 23592
Project: 23592
Buggy source:
private void showAlmostAtAccountLoginDialog(){
  int timeoutInSeconds=(int)LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
  String message=mContext.getString(R.string.lockscreen_failed_attempts_almost_glogin,LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT,LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT,timeoutInSeconds);
  final AlertDialog dialog=new AlertDialog.Builder(mContext).setTitle(null).setMessage(message).setNeutralButton(R.string.ok,null).create();
  dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  dialog.show();
}

Fixed version (ground truth):
private void showAlmostAtAccountLoginDialog(){
  int timeoutInSeconds=(int)LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
  String message=mContext.getString(R.string.lockscreen_failed_attempts_almost_glogin,LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT,LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT,timeoutInSeconds);
  final AlertDialog dialog=new AlertDialog.Builder(mContext).setTitle(null).setMessage(message).setNeutralButton(R.string.ok,null).create();
  dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  if (!mContext.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  dialog.show();
}
Program: 23593
Project: 23593
Buggy source:
private void showTimeoutDialog(){
  int timeoutInSeconds=(int)LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
  String message=mContext.getString(R.string.lockscreen_too_many_failed_attempts_dialog_message,mUpdateMonitor.getFailedAttempts(),timeoutInSeconds);
  final AlertDialog dialog=new AlertDialog.Builder(mContext).setTitle(null).setMessage(message).setNeutralButton(R.string.ok,null).create();
  dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  dialog.show();
}

Fixed version (ground truth):
private void showTimeoutDialog(){
  int timeoutInSeconds=(int)LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
  String message=mContext.getString(R.string.lockscreen_too_many_failed_attempts_dialog_message,mUpdateMonitor.getFailedAttempts(),timeoutInSeconds);
  final AlertDialog dialog=new AlertDialog.Builder(mContext).setTitle(null).setMessage(message).setNeutralButton(R.string.ok,null).create();
  dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  if (!mContext.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  dialog.show();
}
Program: 23595
Project: 23595
Buggy source:
private Dialog getSimUnlockProgressDialog(){
  if (mSimUnlockProgressDialog == null) {
    mSimUnlockProgressDialog=new ProgressDialog(mContext);
    mSimUnlockProgressDialog.setMessage(mContext.getString(R.string.lockscreen_sim_unlock_progress_dialog_message));
    mSimUnlockProgressDialog.setIndeterminate(true);
    mSimUnlockProgressDialog.setCancelable(false);
    mSimUnlockProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    mSimUnlockProgressDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  }
  return mSimUnlockProgressDialog;
}

Fixed version (ground truth):
private Dialog getSimUnlockProgressDialog(){
  if (mSimUnlockProgressDialog == null) {
    mSimUnlockProgressDialog=new ProgressDialog(mContext);
    mSimUnlockProgressDialog.setMessage(mContext.getString(R.string.lockscreen_sim_unlock_progress_dialog_message));
    mSimUnlockProgressDialog.setIndeterminate(true);
    mSimUnlockProgressDialog.setCancelable(false);
    mSimUnlockProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    if (!mContext.getResources().getBoolean(com.android.internal.R.bool.config_sf_slowBlur)) {
      mSimUnlockProgressDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    }
  }
  return mSimUnlockProgressDialog;
}
Program: 23596
Project: 23596
Buggy source:
void updatePlugged(){
  Intent powerIntent=mContext.registerReceiver(null,mBatteryStatusFilter);
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + powerIntent.getExtras());
  if (powerIntent != null) {
    mPlugged=powerIntent.getIntExtra(BatteryManager.EXTRA_PLUGGED,0);
    if (localLOGV)     Log.v(TAG,"String_Node_Str" + mPlugged);
  }
}

Fixed version (ground truth):
void updatePlugged(Intent powerIntent){
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + powerIntent.getExtras());
  if (powerIntent != null) {
    mPlugged=powerIntent.getIntExtra(BatteryManager.EXTRA_PLUGGED,0);
    if (localLOGV)     Log.v(TAG,"String_Node_Str" + mPlugged);
  }
}
Program: 23598
Project: 23598
Buggy source:
public void onReceive(Context context,Intent intent){
  mDockState=intent.getIntExtra(Intent.EXTRA_DOCK_STATE,Intent.EXTRA_DOCK_STATE_UNDOCKED);
  updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
  updateKeepScreenOn();
  updateOrientationListenerLp();
}

Fixed version (ground truth):
public void onReceive(Context context,Intent intent){
  mDockState=intent.getIntExtra(Intent.EXTRA_DOCK_STATE,Intent.EXTRA_DOCK_STATE_UNDOCKED);
  boolean watchBattery=mDockState != Intent.EXTRA_DOCK_STATE_UNDOCKED;
  if (watchBattery != mRegisteredBatteryReceiver) {
    mRegisteredBatteryReceiver=watchBattery;
    if (watchBattery) {
      updatePlugged(mContext.registerReceiver(mBatteryReceiver,mBatteryStatusFilter));
    }
 else {
      mContext.unregisterReceiver(mBatteryReceiver);
    }
  }
  updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
  updateDockKeepingScreenOn();
  updateOrientationListenerLp();
}
Program: 23599
Project: 23599
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: 23600
Project: 23600
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: 23602
Project: 23602
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: 23604
Project: 23604
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: 23605
Project: 23605
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: 23607
Project: 23607
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: 23610
Project: 23610
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: 23611
Project: 23611
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;
}