コード例 #1
0
 private void handlePasswordError(int res) {
   state = State.FAILED;
   StringBuilder sb = new StringBuilder(getScString());
   sb.append("\n");
   sb.append(context.getText(res));
   message = sb;
   phone.onMMIDone(this);
 }
コード例 #2
0
  private CharSequence createQueryCallBarringResultMessage(int serviceClass) {
    StringBuilder sb =
        new StringBuilder(context.getText(com.android.internal.R.string.serviceEnabledFor));

    for (int classMask = 1; classMask <= SERVICE_CLASS_MAX; classMask <<= 1) {
      if ((classMask & serviceClass) != 0) {
        sb.append("\n");
        sb.append(serviceClassToCFString(classMask & serviceClass));
      }
    }
    return sb;
  }
コード例 #3
0
  private void onQueryCfComplete(AsyncResult ar) {
    StringBuilder sb = new StringBuilder(getScString());
    sb.append("\n");

    if (ar.exception != null) {
      state = State.FAILED;
      sb.append(getErrorMessage(ar));
    } else {
      CallForwardInfo infos[];

      infos = (CallForwardInfo[]) ar.result;

      if (infos.length == 0) {
        // Assume the default is not active
        sb.append(context.getText(com.android.internal.R.string.serviceDisabled));

        // Set unconditional CFF in SIM to false
        if (phone.mSIMRecords != null) {
          phone.setCallForwardingPreference(false);
          phone.mSIMRecords.setVoiceCallForwardingFlag(1, false);
        } else {
          Log.w(LOG_TAG, "setVoiceCallForwardingFlag aborted. sim records is null.");
        }
      } else {

        SpannableStringBuilder tb = new SpannableStringBuilder();

        // Each bit in the service class gets its own result line
        // The service classes may be split up over multiple
        // CallForwardInfos. So, for each service class, find out
        // which CallForwardInfo represents it and then build
        // the response text based on that

        for (int serviceClassMask = 1;
            serviceClassMask <= SERVICE_CLASS_MAX;
            serviceClassMask <<= 1) {
          for (int i = 0, s = infos.length; i < s; i++) {
            if ((serviceClassMask & infos[i].serviceClass) != 0) {
              tb.append(makeCFQueryResultMessage(infos[i], serviceClassMask));
              tb.append("\n");
            }
          }
        }
        sb.append(tb);
      }

      state = State.COMPLETE;
    }

    message = sb;
    phone.onMMIDone(this);
  }
コード例 #4
0
  private void onQueryComplete(AsyncResult ar) {
    StringBuilder sb = new StringBuilder(getScString());
    sb.append("\n");

    if (ar.exception != null) {
      state = State.FAILED;
      sb.append(getErrorMessage(ar));
    } else {
      int[] ints = (int[]) ar.result;

      if (ints.length != 0) {
        if (ints[0] == 0) {
          sb.append(context.getText(com.android.internal.R.string.serviceDisabled));
        } else if (sc.equals(SC_WAIT)) {
          // Call Waiting includes additional data in the response.
          sb.append(createQueryCallWaitingResultMessage(ints[1]));
        } else if (isServiceCodeCallBarring(sc)) {
          // ints[0] for Call Barring is a bit vector of services
          sb.append(createQueryCallBarringResultMessage(ints[0]));
        } else if (ints[0] == 1) {
          // for all other services, treat it as a boolean
          sb.append(context.getText(com.android.internal.R.string.serviceEnabled));
        } else {
          sb.append(context.getText(com.android.internal.R.string.mmiError));
        }
      } else {
        sb.append(context.getText(com.android.internal.R.string.mmiError));
      }
      state = State.COMPLETE;
    }

    message = sb;
    phone.onMMIDone(this);
  }
コード例 #5
0
  public void proceedAfterWildChar(String str) {
    if (postDialState != PostDialState.WILD) {
      Log.w(
          LOG_TAG,
          "CdmaConnection.proceedAfterWaitChar(): Expected "
              + "getPostDialState() to be WILD but was "
              + postDialState);
      return;
    }

    setPostDialState(PostDialState.STARTED);

    if (false) {
      boolean playedTone = false;
      int len = (str != null ? str.length() : 0);

      for (int i = 0; i < len; i++) {
        char c = str.charAt(i);
        Message msg = null;

        if (i == len - 1) {
          msg = h.obtainMessage(EVENT_DTMF_DONE);
        }

        if (PhoneNumberUtils.is12Key(c)) {
          owner.cm.sendDtmf(c, msg);
          playedTone = true;
        }
      }

      if (!playedTone) {
        processNextPostDialChar();
      }
    } else {
      // make a new postDialString, with the wild char replacement string
      // at the beginning, followed by the remaining postDialString.

      StringBuilder buf = new StringBuilder(str);
      buf.append(postDialString.substring(nextPostDialChar));
      postDialString = buf.toString();
      nextPostDialChar = 0;
      if (Phone.DEBUG_PHONE) {
        log("proceedAfterWildChar: new postDialString is " + postDialString);
      }

      processNextPostDialChar();
    }
  }
コード例 #6
0
  private void onSetComplete(AsyncResult ar) {
    StringBuilder sb = new StringBuilder(getScString());
    sb.append("\n");

    if (ar.exception != null) {
      state = State.FAILED;
      if (ar.exception instanceof CommandException) {
        CommandException.Error err = ((CommandException) (ar.exception)).getCommandError();
        if (err == CommandException.Error.PASSWORD_INCORRECT) {
          if (isPinCommand()) {
            // look specifically for the PUK commands and adjust
            // the message accordingly.
            if (sc.equals(SC_PUK) || sc.equals(SC_PUK2)) {
              sb.append(context.getText(com.android.internal.R.string.badPuk));
            } else {
              sb.append(context.getText(com.android.internal.R.string.badPin));
            }
          } else {
            sb.append(context.getText(com.android.internal.R.string.passwordIncorrect));
          }
        } else if (err == CommandException.Error.SIM_PUK2) {
          sb.append(context.getText(com.android.internal.R.string.badPin));
          sb.append("\n");
          sb.append(context.getText(com.android.internal.R.string.needPuk2));
        } else if (err == CommandException.Error.FDN_CHECK_FAILURE) {
          Log.i(LOG_TAG, "FDN_CHECK_FAILURE");
          sb.append(context.getText(com.android.internal.R.string.mmiFdnError));
        } else {
          sb.append(context.getText(com.android.internal.R.string.mmiError));
        }
      } else {
        sb.append(context.getText(com.android.internal.R.string.mmiError));
      }
    } else if (isActivate()) {
      state = State.COMPLETE;
      if (isCallFwdRegister) {
        sb.append(context.getText(com.android.internal.R.string.serviceRegistered));
        isCallFwdRegister = false;
      } else {
        sb.append(context.getText(com.android.internal.R.string.serviceEnabled));
      }
      // Record CLIR setting
      if (sc.equals(SC_CLIR)) {
        phone.saveClirSetting(CommandsInterface.CLIR_INVOCATION);
      }
    } else if (isDeactivate()) {
      state = State.COMPLETE;
      sb.append(context.getText(com.android.internal.R.string.serviceDisabled));
      // Record CLIR setting
      if (sc.equals(SC_CLIR)) {
        phone.saveClirSetting(CommandsInterface.CLIR_SUPPRESSION);
      }
    } else if (isRegister()) {
      state = State.COMPLETE;
      sb.append(context.getText(com.android.internal.R.string.serviceRegistered));
    } else if (isErasure()) {
      state = State.COMPLETE;
      sb.append(context.getText(com.android.internal.R.string.serviceErased));
    } else {
      state = State.FAILED;
      sb.append(context.getText(com.android.internal.R.string.mmiError));
    }

    message = sb;
    phone.onMMIDone(this);
  }
コード例 #7
0
  private void onGetClirComplete(AsyncResult ar) {
    StringBuilder sb = new StringBuilder(getScString());
    sb.append("\n");

    if (ar.exception != null) {
      state = State.FAILED;
      sb.append(getErrorMessage(ar));
    } else {
      int clirArgs[];

      clirArgs = (int[]) ar.result;

      // the 'm' parameter from TS 27.007 7.7
      switch (clirArgs[1]) {
        case 0: // CLIR not provisioned
          sb.append(context.getText(com.android.internal.R.string.serviceNotProvisioned));
          state = State.COMPLETE;
          break;

        case 1: // CLIR provisioned in permanent mode
          sb.append(context.getText(com.android.internal.R.string.CLIRPermanent));
          state = State.COMPLETE;
          break;

        case 2: // unknown (e.g. no network, etc.)
          sb.append(context.getText(com.android.internal.R.string.mmiError));
          state = State.FAILED;
          break;

        case 3: // CLIR temporary mode presentation restricted

          // the 'n' parameter from TS 27.007 7.7
          switch (clirArgs[0]) {
            default:
            case 0: // Default
              sb.append(context.getText(com.android.internal.R.string.CLIRDefaultOnNextCallOn));
              break;
            case 1: // CLIR invocation
              sb.append(context.getText(com.android.internal.R.string.CLIRDefaultOnNextCallOn));
              break;
            case 2: // CLIR suppression
              sb.append(context.getText(com.android.internal.R.string.CLIRDefaultOnNextCallOff));
              break;
          }
          state = State.COMPLETE;
          break;

        case 4: // CLIR temporary mode presentation allowed
          // the 'n' parameter from TS 27.007 7.7
          switch (clirArgs[0]) {
            default:
            case 0: // Default
              sb.append(context.getText(com.android.internal.R.string.CLIRDefaultOffNextCallOff));
              break;
            case 1: // CLIR invocation
              sb.append(context.getText(com.android.internal.R.string.CLIRDefaultOffNextCallOn));
              break;
            case 2: // CLIR suppression
              sb.append(context.getText(com.android.internal.R.string.CLIRDefaultOffNextCallOff));
              break;
          }

          state = State.COMPLETE;
          break;
      }
    }

    message = sb;
    phone.onMMIDone(this);
  }