[Android P][Network data][Notes1]DcTracker setDataProfile 判断APN modemCognitive and requestNetwork se

听闻少年二字,当与平庸相斥。这篇文章主要讲述[Android P][Network data][Notes1]DcTracker setDataProfile 判断APN modemCognitive and requestNetwork se相关的知识,希望能为你提供帮助。
【[Android P][Network data][Notes1]DcTracker setDataProfile 判断APN modemCognitive and requestNetwork se】一、setDataProfile(apn.modemCognitive-> ??aosp apn not invoke setDataProfilesAsNeeded??):
DcTracker.setDataProfilesAsNeeded
      -> for (ApnSetting apn : mAllApnSettings) {
      -> if (apn.modemCognitive) {
      -> ...-> RIL.setDataProfile-> RIL_REQUEST_SET_DATA_PROFILE-> ...-> ril_service.cpp
-> RadioImpl::setDataProfile-> RIL_REQUEST_SET_DATA_PROFILE-> ...-> reference-ril.c.onRequest-> ??

Telephony.Carriers.MODEM_COGNITIVE:
              /**
                * Is the apn setting to be set in modem
                * < P> Type: INTEGER (boolean)< /P>
                *@hide
                */
              public static final String MODEM_COGNITIVE = "modem_cognitive";

(setModemCognitive:
DevicePolicyManager.getOverrideApns-> DevicePolicyManagerService.getOverrideApns
-> getOverrideApnsUnchecked-> ApnSetting.makeApnSetting-> setModemCognitive)


二、requestNetwork set mApnSetting(from APN_TYPE_DUN/mAllApnSettings):
DcTracker.requestNetwork-> ...-> trySetupData
      -> int radioTech = mPhone.getServiceState().getRilDataRadioTechnology();
      -> ArrayList< ApnSetting> waitingApns =
                                              buildWaitingApns(apnContext.getApnType(), radioTech);
-> ...(APN_TYPE_DUN/mPreferredApn/mAllApnSettings(
            -> for (ApnSetting apn : mAllApnSettings) {
            -> if (apn.canHandleType(requestedApnType)) {
            -> ServiceState.bitmaskHasTech(apn.networkTypeBitmask,
                                                      ServiceState.rilRadioTechnologyToNetworkType(radioTech))))
      -> apnContext.setWaitingApns(waitingApns); -> RetryManager.setWaitingApns-> mWaitingApns
      -> setupData
            -> apnSetting = apnContext.getNextApnSetting(); -> RetryManager.getNextApnSetting-> mWaitingApns.get
            -> apnContext.setApnSetting(apnSetting); -> apnContext.mApnSetting

mPreferredApn(from apnContext.getApnSetting):
DcTracker.requestNetwork-> ...-> setupData-> EVENT_DATA_SETUP_COMPLETE-> ...-> onDataSetupComplete
      -> ApnSetting apn = apnContext.getApnSetting(); -> ApnContext.mApnSetting
      -> mPreferredApn = apn;
      -> setPreferredApn(mPreferredApn.id)

buildWaitingApns:
      /**
        * Build a list of APNs to be used to create PDP‘s.
      private ArrayList< ApnSetting> buildWaitingApns(String requestedApnType, int radioTech) {

setupDataCall mApnSetting(from apnContext.getApnSetting):
DataConnection.DcInactiveState.processMessage-> EVENT_CONNECT
      -> initConnection-> mApnSetting = apnContext.getApnSetting(); -> ApnContext.mApnSetting
      -> onConnect(ConnectionParams cp)
            -> DataProfile dp = DcTracker.createDataProfile(mApnSetting, cp.mProfileId);
            -> DataServiceManager.setupDataCall(dp)-> ...-> RIL.setupDataCall(DataProfile dataProfile)
                  -> // Convert to HAL data profile
                              DataProfileInfo dpi = convertToHalDataProfile(dataProfile);
                  -> radioProxy.setupDataCall(rr.mSerial, dataRat, dpi,
                                                      dataProfile.isModemCognitive())
                                                     

mRilDataRadioTechnology(getRilDataRadioTechnology):
ServiceStateTracker.EVENT_POLL_STATE_GPRS
      -> NetworkRegistrationState networkRegState = (NetworkRegistrationState) ar.result;
      -> int newDataRat = ServiceState.networkTypeToRilRadioTechnology(
                                              networkRegState.getAccessNetworkTechnology()); -> mAccessNetworkTechnology
      -> ServiceState.setRilDataRadioTechnology(newDataRat)-> this.mRilDataRadioTechnology = newDataRat; < -getRilDataRadioTechnology

NetworkRegistrationState.mAccessNetworkTechnology(from mCi):
CellularNetworkService.getNetworkRegistrationState-> mPhone.mCi.getDataRegistrationState-> GET_PS_REGISTRATION_STATE_DONE
-> ...-> getRegistrationStateFromResult-> createRegistrationStateFromDataRegState(Object result)
      -> if (result instanceof android.hardware.radio.V1_0.DataRegStateResult) {
      -> android.hardware.radio.V1_0.DataRegStateResult dataRegState =
                                              (android.hardware.radio.V1_0.DataRegStateResult) result;
      -> int accessNetworkTechnology = getAccessNetworkTechnologyFromRat(dataRegState.rat); -> ServiceState.rilRadioTechnologyToNetworkType(rilRat)
      -> return new NetworkRegistrationState(transportType, domain, regState,
                                              accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                                              cellIdentity, maxDataCalls); -> mAccessNetworkTechnology = accessNetworkTechnology;
      -> ...(V1_2)

(ServiceStateTracker.pollState
      -> mRegStateManagers.get(AccessNetworkConstants.TransportType.WWAN)
                                              .getNetworkRegistrationState(NetworkRegistrationState.DOMAIN_PS,
                                              obtainMessage(EVENT_POLL_STATE_GPRS, mPollingContext));
private final SparseArray< NetworkRegistrationManager> mRegStateManagers = new SparseArray< > ();
NetworkRegistrationManager)

ServiceState
      public static int rilRadioTechnologyToNetworkType(@RilRadioTechnology int rt) {
              switch(rt) {
              case ServiceState.RIL_RADIO_TECHNOLOGY_GPRS:
                      return TelephonyManager.NETWORK_TYPE_GPRS;
              case ServiceState.RIL_RADIO_TECHNOLOGY_EDGE:
                      return TelephonyManager.NETWORK_TYPE_EDGE;
              case ServiceState.RIL_RADIO_TECHNOLOGY_UMTS:
                      return TelephonyManager.NETWORK_TYPE_UMTS;
              case ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA:
                      return TelephonyManager.NETWORK_TYPE_HSDPA;
              case ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA:
                      return TelephonyManager.NETWORK_TYPE_HSUPA;
              case ServiceState.RIL_RADIO_TECHNOLOGY_HSPA:
                      return TelephonyManager.NETWORK_TYPE_HSPA;
              case ServiceState.RIL_RADIO_TECHNOLOGY_IS95A:
              case ServiceState.RIL_RADIO_TECHNOLOGY_IS95B:
                      return TelephonyManager.NETWORK_TYPE_CDMA;
              case ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT:
                      return TelephonyManager.NETWORK_TYPE_1xRTT;
              case ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0:
                      return TelephonyManager.NETWORK_TYPE_EVDO_0;
              case ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A:
                      return TelephonyManager.NETWORK_TYPE_EVDO_A;
              case ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B:
                      return TelephonyManager.NETWORK_TYPE_EVDO_B;
              case ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD:
                      return TelephonyManager.NETWORK_TYPE_EHRPD;
              case ServiceState.RIL_RADIO_TECHNOLOGY_LTE:
                      return TelephonyManager.NETWORK_TYPE_LTE;
              case ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP:
                      return TelephonyManager.NETWORK_TYPE_HSPAP;
              case ServiceState.RIL_RADIO_TECHNOLOGY_GSM:
                      return TelephonyManager.NETWORK_TYPE_GSM;
              case ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA:
                      return TelephonyManager.NETWORK_TYPE_TD_SCDMA;
              case ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN:
                      return TelephonyManager.NETWORK_TYPE_IWLAN;
              case ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA:
                      return TelephonyManager.NETWORK_TYPE_LTE_CA;
              default:
                      return TelephonyManager.NETWORK_TYPE_UNKNOWN;
              }
      }

    推荐阅读