Program: 184756
Project: 184756
Buggy source:
public BluetoothHandsfree(Context context,Phone phone){
  mPhone=phone;
  mContext=context;
  BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter();
  boolean bluetoothCapable=(adapter != null);
  mHeadset=null;
  mA2dp=new BluetoothA2dp(mContext);
  mA2dpState=BluetoothA2dp.STATE_DISCONNECTED;
  mA2dpDevice=null;
  mPowerManager=(PowerManager)context.getSystemService(Context.POWER_SERVICE);
  mStartCallWakeLock=mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,TAG + "String_Node_Str");
  mStartCallWakeLock.setReferenceCounted(false);
  mStartVoiceRecognitionWakeLock=mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,TAG + "String_Node_Str");
  mStartVoiceRecognitionWakeLock.setReferenceCounted(false);
  mLocalBrsf=BRSF_AG_THREE_WAY_CALLING | BRSF_AG_EC_NR | BRSF_AG_REJECT_CALL| BRSF_AG_ENHANCED_CALL_STATUS;
  if (sVoiceCommandIntent == null) {
    sVoiceCommandIntent=new Intent(Intent.ACTION_VOICE_COMMAND);
    sVoiceCommandIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  }
  if (mContext.getPackageManager().resolveActivity(sVoiceCommandIntent,0) != null && !BluetoothHeadset.DISABLE_BT_VOICE_DIALING) {
    mLocalBrsf|=BRSF_AG_VOICE_RECOG;
  }
  if (bluetoothCapable) {
    resetAtState();
  }
  mRingingCall=mPhone.getRingingCall();
  mForegroundCall=mPhone.getForegroundCall();
  mBackgroundCall=mPhone.getBackgroundCall();
  mBluetoothPhoneState=new BluetoothPhoneState();
  mUserWantsAudio=true;
  mPhonebook=new BluetoothAtPhonebook(mContext,this);
  mAudioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  cdmaSetSecondCallState(false);
}

Fixed version (ground truth):
public BluetoothHandsfree(Context context,Phone phone){
  mPhone=phone;
  mContext=context;
  BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter();
  boolean bluetoothCapable=(adapter != null);
  mHeadset=null;
  mA2dp=new BluetoothA2dp(mContext);
  mA2dpState=BluetoothA2dp.STATE_DISCONNECTED;
  mA2dpDevice=null;
  mA2dpSuspended=false;
  mPowerManager=(PowerManager)context.getSystemService(Context.POWER_SERVICE);
  mStartCallWakeLock=mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,TAG + "String_Node_Str");
  mStartCallWakeLock.setReferenceCounted(false);
  mStartVoiceRecognitionWakeLock=mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,TAG + "String_Node_Str");
  mStartVoiceRecognitionWakeLock.setReferenceCounted(false);
  mLocalBrsf=BRSF_AG_THREE_WAY_CALLING | BRSF_AG_EC_NR | BRSF_AG_REJECT_CALL| BRSF_AG_ENHANCED_CALL_STATUS;
  if (sVoiceCommandIntent == null) {
    sVoiceCommandIntent=new Intent(Intent.ACTION_VOICE_COMMAND);
    sVoiceCommandIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  }
  if (mContext.getPackageManager().resolveActivity(sVoiceCommandIntent,0) != null && !BluetoothHeadset.DISABLE_BT_VOICE_DIALING) {
    mLocalBrsf|=BRSF_AG_VOICE_RECOG;
  }
  if (bluetoothCapable) {
    resetAtState();
  }
  mRingingCall=mPhone.getRingingCall();
  mForegroundCall=mPhone.getForegroundCall();
  mBackgroundCall=mPhone.getBackgroundCall();
  mBluetoothPhoneState=new BluetoothPhoneState();
  mUserWantsAudio=true;
  mPhonebook=new BluetoothAtPhonebook(mContext,this);
  mAudioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  cdmaSetSecondCallState(false);
}