Example #1
0
  // ***** Class Methods
  public PhoneProxy(Phone phone) {
    mActivePhone = phone;
    mResetModemOnRadioTechnologyChange =
        SystemProperties.getBoolean(TelephonyProperties.PROPERTY_RESET_ON_RADIO_TECH_CHANGE, false);
    mIccSmsInterfaceManagerProxy =
        new IccSmsInterfaceManagerProxy(phone.getIccSmsInterfaceManager());
    mIccPhoneBookInterfaceManagerProxy =
        new IccPhoneBookInterfaceManagerProxy(phone.getIccPhoneBookInterfaceManager());
    mPhoneSubInfoProxy = new PhoneSubInfoProxy(phone.getPhoneSubInfo());
    mCommandsInterface = ((PhoneBase) mActivePhone).mCM;

    mCommandsInterface.registerForRilConnected(this, EVENT_RIL_CONNECTED, null);
    mCommandsInterface.registerForOn(this, EVENT_RADIO_ON, null);
    mCommandsInterface.registerForVoiceRadioTechChanged(this, EVENT_VOICE_RADIO_TECH_CHANGED, null);
  }
Example #2
0
 public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager() {
   return mActivePhone.getIccPhoneBookInterfaceManager();
 }
Example #3
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);
  }