Program: 184895
Project: 184895
Buggy source:
/** 
 * Register AT Command handlers to implement the Handsfree profile
 */
private void initializeHandsfreeAtParser(){
  if (DBG)   log("String_Node_Str");
  AtParser parser=mHeadset.getAtParser();
  parser.register('A',new AtCommandHandler(){
    @Override public AtCommandResult handleBasicCommand(    String args){
      PhoneUtils.answerCall(mPhone);
      return new AtCommandResult(AtCommandResult.OK);
    }
  }
);
  parser.register('D',new AtCommandHandler(){
    @Override public AtCommandResult handleBasicCommand(    String args){
      if (args.length() > 0) {
        if (args.charAt(0) == '>') {
          if (args.startsWith("String_Node_Str")) {
            return new AtCommandResult(AtCommandResult.ERROR);
          }
          return redial();
        }
 else {
          if (args.charAt(args.length() - 1) == ';') {
            args=args.substring(0,args.length() - 1);
          }
          Intent intent=new Intent(Intent.ACTION_CALL_PRIVILEGED,Uri.fromParts("String_Node_Str",args,null));
          intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          mContext.startActivity(intent);
          expectCallStart();
          return new AtCommandResult(AtCommandResult.UNSOLICITED);
        }
      }
      return new AtCommandResult(AtCommandResult.ERROR);
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      if (!mForegroundCall.isIdle()) {
        PhoneUtils.hangup(mForegroundCall);
      }
 else       if (!mRingingCall.isIdle()) {
        PhoneUtils.hangup(mRingingCall);
      }
 else       if (!mBackgroundCall.isIdle()) {
        PhoneUtils.hangup(mBackgroundCall);
      }
      return new AtCommandResult(AtCommandResult.OK);
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    private AtCommandResult sendBRSF(){
      return new AtCommandResult("String_Node_Str" + mLocalBrsf);
    }
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      if (args.length == 1 && (args[0] instanceof Integer)) {
        mRemoteBrsf=(Integer)args[0];
      }
 else {
        Log.w(TAG,"String_Node_Str");
      }
      return sendBRSF();
    }
    @Override public AtCommandResult handleActionCommand(){
      return sendBRSF();
    }
    @Override public AtCommandResult handleReadCommand(){
      return sendBRSF();
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      return new AtCommandResult(AtCommandResult.OK);
    }
    @Override public AtCommandResult handleReadCommand(){
      return new AtCommandResult("String_Node_Str");
    }
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      return new AtCommandResult(AtCommandResult.OK);
    }
    @Override public AtCommandResult handleTestCommand(){
      return new AtCommandResult("String_Node_Str");
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleReadCommand(){
      return new AtCommandResult("String_Node_Str" + (mIndicatorsEnabled ? "String_Node_Str" : "String_Node_Str"));
    }
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      if (args.length < 4) {
        return new AtCommandResult(AtCommandResult.ERROR);
      }
 else       if (args[0].equals(3) && args[1].equals(0) && args[2].equals(0)) {
        boolean valid=false;
        if (args[3].equals(0)) {
          mIndicatorsEnabled=false;
          valid=true;
        }
 else         if (args[3].equals(1)) {
          mIndicatorsEnabled=true;
          valid=true;
        }
        if (valid) {
          if ((mRemoteBrsf & BRSF_HF_CW_THREE_WAY_CALLING) == 0x0) {
            mServiceConnectionEstablished=true;
            sendURC("String_Node_Str");
            if (isIncallAudio()) {
              audioOn();
            }
            return new AtCommandResult(AtCommandResult.UNSOLICITED);
          }
 else {
            return new AtCommandResult(AtCommandResult.OK);
          }
        }
      }
      return reportCmeError(BluetoothCmeError.OPERATION_NOT_SUPPORTED);
    }
    @Override public AtCommandResult handleTestCommand(){
      return new AtCommandResult("String_Node_Str");
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      mCmee=true;
      return new AtCommandResult(AtCommandResult.OK);
    }
    @Override public AtCommandResult handleReadCommand(){
      return new AtCommandResult("String_Node_Str" + (mCmee ? "String_Node_Str" : "String_Node_Str"));
    }
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      if (args.length == 0) {
        mCmee=false;
        return new AtCommandResult(AtCommandResult.OK);
      }
 else       if (!(args[0] instanceof Integer)) {
        return new AtCommandResult(AtCommandResult.ERROR);
      }
 else {
        mCmee=((Integer)args[0] == 1);
        return new AtCommandResult(AtCommandResult.OK);
      }
    }
    @Override public AtCommandResult handleTestCommand(){
      return new AtCommandResult("String_Node_Str");
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      return redial();
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleReadCommand(){
      return mPhoneState.toCindResult();
    }
    @Override public AtCommandResult handleTestCommand(){
      return mPhoneState.getCindTestResult();
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      return mPhoneState.toCsqResult();
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleReadCommand(){
      return new AtCommandResult(mPhoneState.toCregString());
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      if (args.length >= 1) {
        char c;
        if (args[0] instanceof Integer) {
          c=((Integer)args[0]).toString().charAt(0);
        }
 else {
          c=((String)args[0]).charAt(0);
        }
        if (isValidDtmf(c)) {
          mPhone.sendDtmf(c);
          return new AtCommandResult(AtCommandResult.OK);
        }
      }
      return new AtCommandResult(AtCommandResult.ERROR);
    }
    private boolean isValidDtmf(    char c){
switch (c) {
case '#':
case '*':
        return true;
default :
      if (Character.digit(c,14) != -1) {
        return true;
      }
    return false;
}
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
return getClccResult();
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args.length >= 1) {
  if (args[0].equals(0)) {
    boolean result;
    if (mRingingCall.isRinging()) {
      result=PhoneUtils.hangupRingingCall(mPhone);
    }
 else {
      result=PhoneUtils.hangupHoldingCall(mPhone);
    }
    if (result) {
      return new AtCommandResult(AtCommandResult.OK);
    }
 else {
      return new AtCommandResult(AtCommandResult.ERROR);
    }
  }
 else   if (args[0].equals(1)) {
    if (PhoneUtils.answerAndEndActive(mPhone)) {
      return new AtCommandResult(AtCommandResult.OK);
    }
 else {
      return new AtCommandResult(AtCommandResult.ERROR);
    }
  }
 else   if (args[0].equals(2)) {
    PhoneUtils.switchHoldingAndActive(mPhone);
    return new AtCommandResult(AtCommandResult.OK);
  }
 else   if (args[0].equals(3)) {
    if (mForegroundCall.getState().isAlive() && mBackgroundCall.getState().isAlive()) {
      PhoneUtils.mergeCalls(mPhone);
    }
    return new AtCommandResult(AtCommandResult.OK);
  }
}
return new AtCommandResult(AtCommandResult.ERROR);
}
@Override public AtCommandResult handleTestCommand(){
mServiceConnectionEstablished=true;
sendURC("String_Node_Str");
if (isIncallAudio()) {
  audioOn();
}
return new AtCommandResult(AtCommandResult.UNSOLICITED);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleReadCommand(){
String operatorName=mPhone.getServiceState().getOperatorAlphaLong();
if (operatorName != null) {
  if (operatorName.length() > 16) {
    operatorName=operatorName.substring(0,16);
  }
  return new AtCommandResult("String_Node_Str" + operatorName + "String_Node_Str");
}
 else {
  return new AtCommandResult("String_Node_Str");
}
}
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args.length != 2 || !(args[0] instanceof Integer) || !(args[1] instanceof Integer)) {
  return new AtCommandResult(AtCommandResult.ERROR);
}
 else if ((Integer)args[0] != 3 || (Integer)args[1] != 0) {
  return reportCmeError(BluetoothCmeError.OPERATION_NOT_SUPPORTED);
}
 else {
  return new AtCommandResult(AtCommandResult.OK);
}
}
@Override public AtCommandResult handleTestCommand(){
return new AtCommandResult("String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleReadCommand(){
return new AtCommandResult("String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleReadCommand(){
return new AtCommandResult(AtCommandResult.OK);
}
@Override public AtCommandResult handleSetCommand(Object[] args){
return new AtCommandResult(AtCommandResult.ERROR);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
String imsi=mPhone.getSubscriberId();
if (imsi == null || imsi.length() == 0) {
  return reportCmeError(BluetoothCmeError.SIM_FAILURE);
}
 else {
  return new AtCommandResult(imsi);
}
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleReadCommand(){
return new AtCommandResult("String_Node_Str" + (mClip ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
}
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args.length >= 1 && (args[0].equals(0) || args[0].equals(1))) {
  mClip=args[0].equals(1);
  return new AtCommandResult(AtCommandResult.OK);
}
 else {
  return new AtCommandResult(AtCommandResult.ERROR);
}
}
@Override public AtCommandResult handleTestCommand(){
return new AtCommandResult("String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
return new AtCommandResult("String_Node_Str" + mPhone.getDeviceId());
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
String model=SystemProperties.get("String_Node_Str");
if (model != null) {
  return new AtCommandResult("String_Node_Str" + model);
}
 else {
  return new AtCommandResult(AtCommandResult.ERROR);
}
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
String manuf=SystemProperties.get("String_Node_Str");
if (manuf != null) {
  return new AtCommandResult("String_Node_Str" + manuf);
}
 else {
  return new AtCommandResult(AtCommandResult.ERROR);
}
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args[0].equals(0)) {
  mAudioManager.setParameter(HEADSET_NREC,"String_Node_Str");
  return new AtCommandResult(AtCommandResult.OK);
}
 else if (args[0].equals(1)) {
  mAudioManager.setParameter(HEADSET_NREC,"String_Node_Str");
  return new AtCommandResult(AtCommandResult.OK);
}
return new AtCommandResult(AtCommandResult.ERROR);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
if (BluetoothHeadset.DISABLE_BT_VOICE_DIALING) {
  return new AtCommandResult(AtCommandResult.ERROR);
}
if (args.length >= 1 && args[0].equals(1)) {
synchronized (BluetoothHandsfree.this) {
    if (!mWaitingForVoiceRecognition) {
      try {
        mContext.startActivity(sVoiceCommandIntent);
      }
 catch (      ActivityNotFoundException e) {
        return new AtCommandResult(AtCommandResult.ERROR);
      }
      expectVoiceRecognition();
    }
  }
  return new AtCommandResult(AtCommandResult.UNSOLICITED);
}
 else if (args.length >= 1 && args[0].equals(0)) {
  audioOff();
  return new AtCommandResult(AtCommandResult.OK);
}
return new AtCommandResult(AtCommandResult.ERROR);
}
@Override public AtCommandResult handleTestCommand(){
return new AtCommandResult("String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
String number=mPhone.getLine1Number();
if (number == null) {
  return new AtCommandResult(AtCommandResult.OK);
}
return new AtCommandResult("String_Node_Str" + number + "String_Node_Str"+ PhoneNumberUtils.toaFromString(number)+ "String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
return new AtCommandResult(AtCommandResult.OK);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args.length != 1 || !(args[0] instanceof Integer)) {
  return new AtCommandResult(AtCommandResult.ERROR);
}
mScoGain=(Integer)args[0];
int flag=mAudioManager.isBluetoothScoOn() ? AudioManager.FLAG_SHOW_UI : 0;
mAudioManager.setStreamVolume(AudioManager.STREAM_BLUETOOTH_SCO,mScoGain,flag);
return new AtCommandResult(AtCommandResult.OK);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
int status=0;
switch (mPhone.getState()) {
case IDLE:
  status=0;
break;
case RINGING:
status=3;
break;
case OFFHOOK:
status=4;
break;
}
return new AtCommandResult("String_Node_Str" + status);
}
}
);
mPhonebook.register(parser);
}

Fixed version (ground truth):
/** 
 * Register AT Command handlers to implement the Handsfree profile
 */
private void initializeHandsfreeAtParser(){
  if (DBG)   log("String_Node_Str");
  AtParser parser=mHeadset.getAtParser();
  parser.register('A',new AtCommandHandler(){
    @Override public AtCommandResult handleBasicCommand(    String args){
      PhoneUtils.answerCall(mPhone);
      return new AtCommandResult(AtCommandResult.OK);
    }
  }
);
  parser.register('D',new AtCommandHandler(){
    @Override public AtCommandResult handleBasicCommand(    String args){
      if (args.length() > 0) {
        if (args.charAt(0) == '>') {
          if (args.startsWith("String_Node_Str")) {
            return new AtCommandResult(AtCommandResult.ERROR);
          }
          return redial();
        }
 else {
          if (args.charAt(args.length() - 1) == ';') {
            args=args.substring(0,args.length() - 1);
          }
          Intent intent=new Intent(Intent.ACTION_CALL_PRIVILEGED,Uri.fromParts("String_Node_Str",args,null));
          intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          mContext.startActivity(intent);
          expectCallStart();
          return new AtCommandResult(AtCommandResult.UNSOLICITED);
        }
      }
      return new AtCommandResult(AtCommandResult.ERROR);
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      if (!mForegroundCall.isIdle()) {
        PhoneUtils.hangup(mForegroundCall);
      }
 else       if (!mRingingCall.isIdle()) {
        PhoneUtils.hangup(mRingingCall);
      }
 else       if (!mBackgroundCall.isIdle()) {
        PhoneUtils.hangup(mBackgroundCall);
      }
      return new AtCommandResult(AtCommandResult.OK);
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    private AtCommandResult sendBRSF(){
      return new AtCommandResult("String_Node_Str" + mLocalBrsf);
    }
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      if (args.length == 1 && (args[0] instanceof Integer)) {
        mRemoteBrsf=(Integer)args[0];
      }
 else {
        Log.w(TAG,"String_Node_Str");
      }
      return sendBRSF();
    }
    @Override public AtCommandResult handleActionCommand(){
      return sendBRSF();
    }
    @Override public AtCommandResult handleReadCommand(){
      return sendBRSF();
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      return new AtCommandResult(AtCommandResult.OK);
    }
    @Override public AtCommandResult handleReadCommand(){
      return new AtCommandResult("String_Node_Str");
    }
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      return new AtCommandResult(AtCommandResult.OK);
    }
    @Override public AtCommandResult handleTestCommand(){
      return new AtCommandResult("String_Node_Str");
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleReadCommand(){
      return new AtCommandResult("String_Node_Str" + (mIndicatorsEnabled ? "String_Node_Str" : "String_Node_Str"));
    }
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      if (args.length < 4) {
        return new AtCommandResult(AtCommandResult.ERROR);
      }
 else       if (args[0].equals(3) && args[1].equals(0) && args[2].equals(0)) {
        boolean valid=false;
        if (args[3].equals(0)) {
          mIndicatorsEnabled=false;
          valid=true;
        }
 else         if (args[3].equals(1)) {
          mIndicatorsEnabled=true;
          valid=true;
        }
        if (valid) {
          if ((mRemoteBrsf & BRSF_HF_CW_THREE_WAY_CALLING) == 0x0) {
            mServiceConnectionEstablished=true;
            sendURC("String_Node_Str");
            if (isIncallAudio()) {
              audioOn();
            }
            return new AtCommandResult(AtCommandResult.UNSOLICITED);
          }
 else {
            return new AtCommandResult(AtCommandResult.OK);
          }
        }
      }
      return reportCmeError(BluetoothCmeError.OPERATION_NOT_SUPPORTED);
    }
    @Override public AtCommandResult handleTestCommand(){
      return new AtCommandResult("String_Node_Str");
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      mCmee=true;
      return new AtCommandResult(AtCommandResult.OK);
    }
    @Override public AtCommandResult handleReadCommand(){
      return new AtCommandResult("String_Node_Str" + (mCmee ? "String_Node_Str" : "String_Node_Str"));
    }
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      if (args.length == 0) {
        mCmee=false;
        return new AtCommandResult(AtCommandResult.OK);
      }
 else       if (!(args[0] instanceof Integer)) {
        return new AtCommandResult(AtCommandResult.ERROR);
      }
 else {
        mCmee=((Integer)args[0] == 1);
        return new AtCommandResult(AtCommandResult.OK);
      }
    }
    @Override public AtCommandResult handleTestCommand(){
      return new AtCommandResult("String_Node_Str");
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      return redial();
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleReadCommand(){
      return mPhoneState.toCindResult();
    }
    @Override public AtCommandResult handleTestCommand(){
      return mPhoneState.getCindTestResult();
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleActionCommand(){
      return mPhoneState.toCsqResult();
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleReadCommand(){
      return new AtCommandResult(mPhoneState.toCregString());
    }
  }
);
  parser.register("String_Node_Str",new AtCommandHandler(){
    @Override public AtCommandResult handleSetCommand(    Object[] args){
      if (args.length >= 1) {
        char c;
        if (args[0] instanceof Integer) {
          c=((Integer)args[0]).toString().charAt(0);
        }
 else {
          c=((String)args[0]).charAt(0);
        }
        if (isValidDtmf(c)) {
          mPhone.sendDtmf(c);
          return new AtCommandResult(AtCommandResult.OK);
        }
      }
      return new AtCommandResult(AtCommandResult.ERROR);
    }
    private boolean isValidDtmf(    char c){
switch (c) {
case '#':
case '*':
        return true;
default :
      if (Character.digit(c,14) != -1) {
        return true;
      }
    return false;
}
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
return getClccResult();
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args.length >= 1) {
  if (args[0].equals(0)) {
    boolean result;
    if (mRingingCall.isRinging()) {
      result=PhoneUtils.hangupRingingCall(mPhone);
    }
 else {
      result=PhoneUtils.hangupHoldingCall(mPhone);
    }
    if (result) {
      return new AtCommandResult(AtCommandResult.OK);
    }
 else {
      return new AtCommandResult(AtCommandResult.ERROR);
    }
  }
 else   if (args[0].equals(1)) {
    if (PhoneUtils.answerAndEndActive(mPhone)) {
      return new AtCommandResult(AtCommandResult.OK);
    }
 else {
      return new AtCommandResult(AtCommandResult.ERROR);
    }
  }
 else   if (args[0].equals(2)) {
    PhoneUtils.switchHoldingAndActive(mPhone);
    return new AtCommandResult(AtCommandResult.OK);
  }
 else   if (args[0].equals(3)) {
    if (mForegroundCall.getState().isAlive() && mBackgroundCall.getState().isAlive()) {
      PhoneUtils.mergeCalls(mPhone);
    }
    return new AtCommandResult(AtCommandResult.OK);
  }
}
return new AtCommandResult(AtCommandResult.ERROR);
}
@Override public AtCommandResult handleTestCommand(){
mServiceConnectionEstablished=true;
sendURC("String_Node_Str");
sendURC("String_Node_Str");
if (isIncallAudio()) {
  audioOn();
}
return new AtCommandResult(AtCommandResult.UNSOLICITED);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleReadCommand(){
String operatorName=mPhone.getServiceState().getOperatorAlphaLong();
if (operatorName != null) {
  if (operatorName.length() > 16) {
    operatorName=operatorName.substring(0,16);
  }
  return new AtCommandResult("String_Node_Str" + operatorName + "String_Node_Str");
}
 else {
  return new AtCommandResult("String_Node_Str");
}
}
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args.length != 2 || !(args[0] instanceof Integer) || !(args[1] instanceof Integer)) {
  return new AtCommandResult(AtCommandResult.ERROR);
}
 else if ((Integer)args[0] != 3 || (Integer)args[1] != 0) {
  return reportCmeError(BluetoothCmeError.OPERATION_NOT_SUPPORTED);
}
 else {
  return new AtCommandResult(AtCommandResult.OK);
}
}
@Override public AtCommandResult handleTestCommand(){
return new AtCommandResult("String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleReadCommand(){
return new AtCommandResult("String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleReadCommand(){
return new AtCommandResult(AtCommandResult.OK);
}
@Override public AtCommandResult handleSetCommand(Object[] args){
return new AtCommandResult(AtCommandResult.ERROR);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
String imsi=mPhone.getSubscriberId();
if (imsi == null || imsi.length() == 0) {
  return reportCmeError(BluetoothCmeError.SIM_FAILURE);
}
 else {
  return new AtCommandResult(imsi);
}
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleReadCommand(){
return new AtCommandResult("String_Node_Str" + (mClip ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
}
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args.length >= 1 && (args[0].equals(0) || args[0].equals(1))) {
  mClip=args[0].equals(1);
  return new AtCommandResult(AtCommandResult.OK);
}
 else {
  return new AtCommandResult(AtCommandResult.ERROR);
}
}
@Override public AtCommandResult handleTestCommand(){
return new AtCommandResult("String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
return new AtCommandResult("String_Node_Str" + mPhone.getDeviceId());
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
String model=SystemProperties.get("String_Node_Str");
if (model != null) {
  return new AtCommandResult("String_Node_Str" + model);
}
 else {
  return new AtCommandResult(AtCommandResult.ERROR);
}
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
String manuf=SystemProperties.get("String_Node_Str");
if (manuf != null) {
  return new AtCommandResult("String_Node_Str" + manuf);
}
 else {
  return new AtCommandResult(AtCommandResult.ERROR);
}
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args[0].equals(0)) {
  mAudioManager.setParameter(HEADSET_NREC,"String_Node_Str");
  return new AtCommandResult(AtCommandResult.OK);
}
 else if (args[0].equals(1)) {
  mAudioManager.setParameter(HEADSET_NREC,"String_Node_Str");
  return new AtCommandResult(AtCommandResult.OK);
}
return new AtCommandResult(AtCommandResult.ERROR);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
if (BluetoothHeadset.DISABLE_BT_VOICE_DIALING) {
  return new AtCommandResult(AtCommandResult.ERROR);
}
if (args.length >= 1 && args[0].equals(1)) {
synchronized (BluetoothHandsfree.this) {
    if (!mWaitingForVoiceRecognition) {
      try {
        mContext.startActivity(sVoiceCommandIntent);
      }
 catch (      ActivityNotFoundException e) {
        return new AtCommandResult(AtCommandResult.ERROR);
      }
      expectVoiceRecognition();
    }
  }
  return new AtCommandResult(AtCommandResult.UNSOLICITED);
}
 else if (args.length >= 1 && args[0].equals(0)) {
  audioOff();
  return new AtCommandResult(AtCommandResult.OK);
}
return new AtCommandResult(AtCommandResult.ERROR);
}
@Override public AtCommandResult handleTestCommand(){
return new AtCommandResult("String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
String number=mPhone.getLine1Number();
if (number == null) {
  return new AtCommandResult(AtCommandResult.OK);
}
return new AtCommandResult("String_Node_Str" + number + "String_Node_Str"+ PhoneNumberUtils.toaFromString(number)+ "String_Node_Str");
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
return new AtCommandResult(AtCommandResult.OK);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleSetCommand(Object[] args){
if (args.length != 1 || !(args[0] instanceof Integer)) {
  return new AtCommandResult(AtCommandResult.ERROR);
}
mScoGain=(Integer)args[0];
int flag=mAudioManager.isBluetoothScoOn() ? AudioManager.FLAG_SHOW_UI : 0;
mAudioManager.setStreamVolume(AudioManager.STREAM_BLUETOOTH_SCO,mScoGain,flag);
return new AtCommandResult(AtCommandResult.OK);
}
}
);
parser.register("String_Node_Str",new AtCommandHandler(){
@Override public AtCommandResult handleActionCommand(){
int status=0;
switch (mPhone.getState()) {
case IDLE:
  status=0;
break;
case RINGING:
status=3;
break;
case OFFHOOK:
status=4;
break;
}
return new AtCommandResult("String_Node_Str" + status);
}
}
);
mPhonebook.register(parser);
}