Ejemplo n.º 1
0
  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();
    }
  }
Ejemplo n.º 2
0
  public DataState getDataConnectionState() {
    DataState ret = DataState.DISCONNECTED;

    if (mSST == null) {
      // Radio Technology Change is ongoning, dispose() and removeReferences() have
      // already been called

      ret = DataState.DISCONNECTED;
    } else if (mSST.getCurrentGprsState() != ServiceState.STATE_IN_SERVICE) {
      // If we're out of service, open TCP sockets may still work
      // but no data will flow
      ret = DataState.DISCONNECTED;
    } else {
        /* mSST.gprsState == ServiceState.STATE_IN_SERVICE */
      switch (mDataConnection.getState()) {
        case FAILED:
        case IDLE:
          ret = DataState.DISCONNECTED;
          break;

        case CONNECTED:
        case DISCONNECTING:
          if (mCT.state != Phone.State.IDLE && !mSST.isConcurrentVoiceAndData()) {
            ret = DataState.SUSPENDED;
          } else {
            ret = DataState.CONNECTED;
          }
          break;

        case INITING:
        case CONNECTING:
        case SCANNING:
          ret = DataState.CONNECTING;
          break;
      }
    }

    return ret;
  }
Ejemplo n.º 3
0
  public DataActivityState getDataActivityState() {
    DataActivityState ret = DataActivityState.NONE;

    if (mSST.getCurrentGprsState() == ServiceState.STATE_IN_SERVICE) {
      switch (mDataConnection.getActivity()) {
        case DATAIN:
          ret = DataActivityState.DATAIN;
          break;

        case DATAOUT:
          ret = DataActivityState.DATAOUT;
          break;

        case DATAINANDOUT:
          ret = DataActivityState.DATAINANDOUT;
          break;
      }
    }

    return ret;
  }
Ejemplo n.º 4
0
 public void setRadioPower(boolean power) {
   mSST.setRadioPower(power);
 }
Ejemplo n.º 5
0
  public GSMPhone(
      Context context, CommandsInterface ci, PhoneNotifier notifier, boolean unitTestMode) {
    super(notifier, context, ci, unitTestMode);

    if (ci instanceof SimulatedRadioControl) {
      mSimulatedRadioControl = (SimulatedRadioControl) ci;
    }

    mCM.setPhoneType(Phone.PHONE_TYPE_GSM);
    mCT = new GsmCallTracker(this);
    mSST = new GsmServiceStateTracker(this);
    mSMS = new GsmSMSDispatcher(this);
    mIccFileHandler = new SIMFileHandler(this);
    mSIMRecords = new SIMRecords(this);
    mDataConnection = new GsmDataConnectionTracker(this);
    mSimCard = new SimCard(this);
    if (!unitTestMode) {
      mSimPhoneBookIntManager = new SimPhoneBookInterfaceManager(this);
      mSimSmsIntManager = new SimSmsInterfaceManager(this, mSMS);
      mSubInfo = new PhoneSubInfo(this);
    }
    mStkService =
        CatService.getInstance(
            mCM, mSIMRecords, mContext, (SIMFileHandler) mIccFileHandler, mSimCard);

    mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
    mSIMRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
    mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
    mCM.registerForOn(this, EVENT_RADIO_ON, null);
    mCM.setOnUSSD(this, EVENT_USSD, null);
    mCM.setOnSuppServiceNotification(this, EVENT_SSN, null);
    mSST.registerForNetworkAttach(this, EVENT_REGISTERED_TO_NETWORK, null);

    if (false) {
      try {
        // debugSocket = new LocalServerSocket("com.android.internal.telephony.debug");
        debugSocket = new ServerSocket();
        debugSocket.setReuseAddress(true);
        debugSocket.bind(new InetSocketAddress("127.0.0.1", 6666));

        debugPortThread =
            new Thread(
                new Runnable() {
                  public void run() {
                    for (; ; ) {
                      try {
                        Socket sock;
                        sock = debugSocket.accept();
                        Log.i(LOG_TAG, "New connection; resetting radio");
                        mCM.resetRadio(null);
                        sock.close();
                      } catch (IOException ex) {
                        Log.w(LOG_TAG, "Exception accepting socket", ex);
                      }
                    }
                  }
                },
                "GSMPhone debug");

        debugPortThread.start();

      } catch (IOException ex) {
        Log.w(LOG_TAG, "Failure to open com.android.internal.telephony.debug socket", ex);
      }
    }

    // Change the system property
    SystemProperties.set(
        TelephonyProperties.CURRENT_ACTIVE_PHONE, new Integer(Phone.PHONE_TYPE_GSM).toString());
  }
Ejemplo n.º 6
0
 public void disableLocationUpdates() {
   mSST.disableLocationUpdates();
 }
Ejemplo n.º 7
0
 public void enableLocationUpdates() {
   mSST.enableLocationUpdates();
 }
Ejemplo n.º 8
0
 public void updateServiceLocation() {
   mSST.enableSingleLocationUpdate();
 }