public Connection dial(String dialString, UUSInfo uusInfo) throws CallStateException {
    // Need to make sure dialString gets parsed properly
    String newDialString = PhoneNumberUtils.stripSeparators(dialString);

    // handle in-call MMI first if applicable
    if (handleInCallMmiCommands(newDialString)) {
      return null;
    }

    // Only look at the Network portion for mmi
    String networkPortion = PhoneNumberUtils.extractNetworkPortionAlt(newDialString);
    GsmMmiCode mmi = GsmMmiCode.newFromDialString(networkPortion, this);
    if (LOCAL_DEBUG) Log.d(LOG_TAG, "dialing w/ mmi '" + mmi + "'...");

    if (mmi == null) {
      return mCT.dial(newDialString, uusInfo);
    } else if (mmi.isTemporaryModeCLIR()) {
      return mCT.dial(mmi.dialingNumber, mmi.getCLIRMode(), uusInfo);
    } else {
      mPendingMMIs.add(mmi);
      mMmiRegistrants.notifyRegistrants(new AsyncResult(null, mmi, null));
      mmi.processCode();

      // FIXME should this return null or something else?
      return null;
    }
  }
  public void dispose() {
    synchronized (PhoneProxy.lockForRadioTechnologyChange) {
      super.dispose();

      // Unregister from all former registered events
      mCM.unregisterForAvailable(this); // EVENT_RADIO_AVAILABLE
      mSIMRecords.unregisterForRecordsLoaded(this); // EVENT_SIM_RECORDS_LOADED
      mCM.unregisterForOffOrNotAvailable(this); // EVENT_RADIO_OFF_OR_NOT_AVAILABLE
      mCM.unregisterForOn(this); // EVENT_RADIO_ON
      mSST.unregisterForNetworkAttach(this); // EVENT_REGISTERED_TO_NETWORK
      mCM.unSetOnUSSD(this);
      mCM.unSetOnSuppServiceNotification(this);

      mPendingMMIs.clear();

      // Force all referenced classes to unregister their former registered events
      mStkService.dispose();
      mCT.dispose();
      mDataConnection.dispose();
      mSST.dispose();
      mIccFileHandler.dispose(); // instance of SimFileHandler
      mSIMRecords.dispose();
      mSimCard.dispose();
      mSimPhoneBookIntManager.dispose();
      mSimSmsIntManager.dispose();
      mSubInfo.dispose();
    }
  }
  private boolean handleCallHoldIncallSupplementaryService(String dialString)
      throws CallStateException {
    int len = dialString.length();

    if (len > 2) {
      return false;
    }

    GsmCall call = (GsmCall) getForegroundCall();

    if (len > 1) {
      try {
        char ch = dialString.charAt(1);
        int callIndex = ch - '0';
        GsmConnection conn = mCT.getConnectionByIndex(call, callIndex);

        // gsm index starts at 1, up to 5 connections in a call,
        if (conn != null && callIndex >= 1 && callIndex <= GsmCallTracker.MAX_CONNECTIONS) {
          if (LOCAL_DEBUG) Log.d(LOG_TAG, "MmiCode 2: separate call " + callIndex);
          mCT.separate(conn);
        } else {
          if (LOCAL_DEBUG) Log.d(LOG_TAG, "separate: invalid call index " + callIndex);
          notifySuppServiceFailed(Phone.SuppService.SEPARATE);
        }
      } catch (CallStateException e) {
        if (LOCAL_DEBUG) Log.d(LOG_TAG, "separate failed", e);
        notifySuppServiceFailed(Phone.SuppService.SEPARATE);
      }
    } else {
      try {
        if (getRingingCall().getState() != GsmCall.State.IDLE) {
          if (LOCAL_DEBUG) Log.d(LOG_TAG, "MmiCode 2: accept ringing call");
          mCT.acceptCall();
        } else {
          if (LOCAL_DEBUG) Log.d(LOG_TAG, "MmiCode 2: switchWaitingOrHoldingAndActive");
          mCT.switchWaitingOrHoldingAndActive();
        }
      } catch (CallStateException e) {
        if (LOCAL_DEBUG) Log.d(LOG_TAG, "switch failed", e);
        notifySuppServiceFailed(Phone.SuppService.SWITCH);
      }
    }

    return true;
  }
  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;
  }
  private boolean handleCallWaitingIncallSupplementaryService(String dialString)
      throws CallStateException {
    int len = dialString.length();

    if (len > 2) {
      return false;
    }

    GsmCall call = (GsmCall) getForegroundCall();

    try {
      if (len > 1) {
        char ch = dialString.charAt(1);
        int callIndex = ch - '0';

        if (callIndex >= 1 && callIndex <= GsmCallTracker.MAX_CONNECTIONS) {
          if (LOCAL_DEBUG) Log.d(LOG_TAG, "MmiCode 1: hangupConnectionByIndex " + callIndex);
          mCT.hangupConnectionByIndex(call, callIndex);
        }
      } else {
        if (call.getState() != GsmCall.State.IDLE) {
          if (LOCAL_DEBUG) Log.d(LOG_TAG, "MmiCode 1: hangup foreground");
          // mCT.hangupForegroundResumeBackground();
          mCT.hangup(call);
        } else {
          if (LOCAL_DEBUG) Log.d(LOG_TAG, "MmiCode 1: switchWaitingOrHoldingAndActive");
          mCT.switchWaitingOrHoldingAndActive();
        }
      }
    } catch (CallStateException e) {
      if (LOCAL_DEBUG) Log.d(LOG_TAG, "hangup failed", e);
      notifySuppServiceFailed(Phone.SuppService.HANGUP);
    }

    return true;
  }
 public void setMute(boolean muted) {
   mCT.setMute(muted);
 }
 public void explicitCallTransfer() throws CallStateException {
   mCT.explicitCallTransfer();
 }
 public void acceptCall() throws CallStateException {
   mCT.acceptCall();
 }
 public void clearDisconnected() {
   mCT.clearDisconnected();
 }
 public void conference() throws CallStateException {
   mCT.conference();
 }
 public boolean canDial() {
   return mCT.canDial();
 }
 public boolean canConference() {
   return mCT.canConference();
 }
 public void switchHoldingAndActive() throws CallStateException {
   mCT.switchWaitingOrHoldingAndActive();
 }
 public void rejectCall() throws CallStateException {
   mCT.rejectCall();
 }
 public boolean getMute() {
   return mCT.getMute();
 }
示例#16
0
 /**
  * Please note: if this is the foreground call and a background call exists, the background call
  * will be resumed because an AT+CHLD=1 will be sent
  */
 public void hangup() throws CallStateException {
   owner.hangup(this);
 }
 public boolean canTransfer() {
   return mCT.canTransfer();
 }