Ejemplo n.º 1
0
 public int getPhoneType() {
   return mActivePhone.getPhoneType();
 }
Ejemplo n.º 2
0
  private void updatePhoneObject(int newVoiceRadioTech) {

    if (mActivePhone != null) {
      if (mRilVersion == 6 && getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE) {
        /*
         * On v6 RIL, when LTE_ON_CDMA is TRUE, always create CDMALTEPhone
         * irrespective of the voice radio tech reported.
         */
        if (mActivePhone.getPhoneType() == PHONE_TYPE_CDMA) {
          logd(
              "LTE ON CDMA property is set. Use CDMA Phone"
                  + " newVoiceRadioTech = "
                  + newVoiceRadioTech
                  + " Active Phone = "
                  + mActivePhone.getPhoneName());
          return;
        } else {
          logd(
              "LTE ON CDMA property is set. Switch to CDMALTEPhone"
                  + " newVoiceRadioTech = "
                  + newVoiceRadioTech
                  + " Active Phone = "
                  + mActivePhone.getPhoneName());
          newVoiceRadioTech = ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT;
        }
      } else {
        if ((ServiceState.isCdma(newVoiceRadioTech)
                && mActivePhone.getPhoneType() == PHONE_TYPE_CDMA)
            || (ServiceState.isGsm(newVoiceRadioTech)
                && mActivePhone.getPhoneType() == PHONE_TYPE_GSM)) {
          // Nothing changed. Keep phone as it is.
          logd(
              "Ignoring voice radio technology changed message."
                  + " newVoiceRadioTech = "
                  + newVoiceRadioTech
                  + " Active Phone = "
                  + mActivePhone.getPhoneName());
          return;
        }
      }
    }

    if (newVoiceRadioTech == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
      // We need some voice phone object to be active always, so never
      // delete the phone without anything to replace it with!
      logd(
          "Ignoring voice radio technology changed message. newVoiceRadioTech = Unknown."
              + " Active Phone = "
              + mActivePhone.getPhoneName());
      return;
    }

    boolean oldPowerState = false; // old power state to off
    if (mResetModemOnRadioTechnologyChange) {
      if (mCommandsInterface.getRadioState().isOn()) {
        oldPowerState = true;
        logd("Setting Radio Power to Off");
        mCommandsInterface.setRadioPower(false, null);
      }
    }

    deleteAndCreatePhone(newVoiceRadioTech);

    if (mResetModemOnRadioTechnologyChange && oldPowerState) { // restore power state
      logd("Resetting Radio");
      mCommandsInterface.setRadioPower(oldPowerState, null);
    }

    // Set the new interfaces in the proxy's
    mIccSmsInterfaceManagerProxy.setmIccSmsInterfaceManager(
        mActivePhone.getIccSmsInterfaceManager());
    mIccPhoneBookInterfaceManagerProxy.setmIccPhoneBookInterfaceManager(
        mActivePhone.getIccPhoneBookInterfaceManager());
    mPhoneSubInfoProxy.setmPhoneSubInfo(this.mActivePhone.getPhoneSubInfo());

    mCommandsInterface = ((PhoneBase) mActivePhone).mCM;

    // Send an Intent to the PhoneApp that we had a radio technology change
    Intent intent = new Intent(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
    intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
    intent.putExtra(Phone.PHONE_NAME_KEY, mActivePhone.getPhoneName());
    ActivityManagerNative.broadcastStickyIntent(intent, null);
  }