/** * Notify all mDataConnectionRatChangeRegistrants using an AsyncResult in msg.obj where * AsyncResult#result contains the new RAT as an Integer Object. */ protected void notifyDataRegStateRilRadioTechnologyChanged() { int rat = mSS.getRilDataRadioTechnology(); int drs = mSS.getDataRegState(); if (DBG) log("notifyDataRegStateRilRadioTechnologyChanged: drs=" + drs + " rat=" + rat); mPhoneBase.setSystemProperty( TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE, ServiceState.rilRadioTechnologyToString(rat)); mDataRegStateOrRatChangedRegistrants.notifyResult(new Pair<Integer, Integer>(drs, rat)); }
/** * Callback invoked when there is any change to any SubscriptionInfo. Typically this method * would invoke {@link SubscriptionManager#getActiveSubscriptionInfoList} */ @Override public void onSubscriptionsChanged() { if (DBG) log("SubscriptionListener.onSubscriptionInfoChanged"); // Set the network type, in case the radio does not restore it. int subId = mPhoneBase.getSubId(); if (mPreviousSubId.getAndSet(subId) != subId) { if (SubscriptionManager.isValidSubscriptionId(subId)) { Context context = mPhoneBase.getContext(); int networkType = PhoneFactory.calculatePreferredNetworkType(context, subId); mCi.setPreferredNetworkType(networkType, null); mPhoneBase.notifyCallForwardingIndicator(); boolean skipRestoringSelection = context .getResources() .getBoolean(com.android.internal.R.bool.skip_restoring_network_selection); if (!skipRestoringSelection) { // restore the previous network selection. mPhoneBase.restoreSavedNetworkSelection(null); } mPhoneBase.setSystemProperty( TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE, ServiceState.rilRadioTechnologyToString(mSS.getRilDataRadioTechnology())); if (mSpnUpdatePending) { mSubscriptionController.setPlmnSpn( mPhoneBase.getPhoneId(), mCurShowPlmn, mCurPlmn, mCurShowSpn, mCurSpn); mSpnUpdatePending = false; } // Remove old network selection sharedPreferences since SP key names are now // changed to include subId. This will be done only once when upgrading from an // older build that did not include subId in the names. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); String oldNetworkSelectionName = sp.getString(PhoneBase.NETWORK_SELECTION_NAME_KEY, ""); String oldNetworkSelection = sp.getString(PhoneBase.NETWORK_SELECTION_KEY, ""); if (!TextUtils.isEmpty(oldNetworkSelectionName) || !TextUtils.isEmpty(oldNetworkSelection)) { SharedPreferences.Editor editor = sp.edit(); editor.putString(PhoneBase.NETWORK_SELECTION_NAME_KEY + subId, oldNetworkSelectionName); editor.putString(PhoneBase.NETWORK_SELECTION_KEY + subId, oldNetworkSelection); editor.remove(PhoneBase.NETWORK_SELECTION_NAME_KEY); editor.remove(PhoneBase.NETWORK_SELECTION_KEY); editor.commit(); } } } }
protected ServiceStateTracker(PhoneBase phoneBase, CommandsInterface ci, CellInfo cellInfo) { mPhoneBase = phoneBase; mCellInfo = cellInfo; mCi = ci; mVoiceCapable = mPhoneBase .getContext() .getResources() .getBoolean(com.android.internal.R.bool.config_voice_capable); mUiccController = UiccController.getInstance(); mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null); mCi.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null); mCi.registerForCellInfoList(this, EVENT_UNSOL_CELL_INFO_LIST, null); mSubscriptionController = SubscriptionController.getInstance(); mSubscriptionManager = SubscriptionManager.from(phoneBase.getContext()); mSubscriptionManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener); mPhoneBase.setSystemProperty( TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE, ServiceState.rilRadioTechnologyToString(ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN)); mCi.registerForImsNetworkStateChanged(this, EVENT_IMS_STATE_CHANGED, null); }