コード例 #1
0
  /* package */ void hangup(GsmCall call) throws CallStateException {
    if (call.getConnections().size() == 0) {
      throw new CallStateException("no connections in call");
    }

    if (call == ringingCall) {
      if (Phone.DEBUG_PHONE) log("(ringing) hangup waiting or background");
      cm.hangupWaitingOrBackground(obtainCompleteMessage());
    } else if (call == foregroundCall) {
      if (call.isDialingOrAlerting()) {
        if (Phone.DEBUG_PHONE) {
          log("(foregnd) hangup dialing or alerting...");
        }
        hangup((GsmConnection) (call.getConnections().get(0)));
      } else {
        hangupForegroundResumeBackground();
      }
    } else if (call == backgroundCall) {
      if (ringingCall.isRinging()) {
        if (Phone.DEBUG_PHONE) {
          log("hangup all conns in background call");
        }
        hangupAllConnections(call);
      } else {
        hangupWaitingOrBackground();
      }
    } else {
      throw new RuntimeException("GsmCall " + call + "does not belong to GsmCallTracker " + this);
    }

    call.onHangupLocal();
    phone.notifyPreciseCallStateChanged();
  }
コード例 #2
0
  private boolean handleCallDeflectionIncallSupplementaryService(String dialString)
      throws CallStateException {
    if (dialString.length() > 1) {
      return false;
    }

    if (getRingingCall().getState() != GsmCall.State.IDLE) {
      if (LOCAL_DEBUG) Log.d(LOG_TAG, "MmiCode 0: rejectCall");
      try {
        mCT.rejectCall();
      } catch (CallStateException e) {
        if (LOCAL_DEBUG) Log.d(LOG_TAG, "reject failed", e);
        notifySuppServiceFailed(Phone.SuppService.REJECT);
      }
    } else if (getBackgroundCall().getState() != GsmCall.State.IDLE) {
      if (LOCAL_DEBUG) Log.d(LOG_TAG, "MmiCode 0: hangupWaitingOrBackground");
      mCT.hangupWaitingOrBackground();
    }

    return true;
  }