trySetupData()里面会再一次做是否可以进行数据业务建立的判断,
1.isDataAllowed(),在该方法里面
会对PS是否attached进行判断boolean attachedState = mAttached.get();
会对sim 卡是否loaded完成进行判断:
IccRecords r = mIccRecords.get();
boolean recordsLoaded = false;
if (r != null) {
recordsLoaded = r.getRecordsLoaded();
if (DBG && !recordsLoaded) log("isDataAllowed getRecordsLoaded=" + recordsLoaded);
}
会对phone的状态,如果phone 的状态是否非idle就说明当前有电话业务,那么就要继续判断当前的radio Tech是否同时支持电话和数据业务.
PhoneConstants.State state = PhoneConstants.State.IDLE;
// Note this is explicitly not using mPhone.getState. See b/19090488.
// mPhone.getState reports the merge of CS and PS (volte) voice call state
// but we only care about CS calls here for data/voice concurrency issues.
// Calling getCallTracker currently gives you just the CS side where the
// ImsCallTracker is held internally where applicable.
// This should be redesigned to ask explicitly what we want:
// voiceCallStateAllowDataCall, or dataCallAllowed or something similar.
if (mPhone.getCallTracker() != null) {
state = mPhone.getCallTracker().getState();
}
if (state != PhoneConstants.State.IDLE &&
!mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()) {
if(failureReason == null) return false;
failureReason.addDataAllowFailReason(DataAllowFailReasonType.INVALID_PHONE_STATE);
failureReason.addDataAllowFailReason(
DataAllowFailReasonType.CONCURRENT_VOICE_DATA_NOT_ALLOWED);
}
会对数据开关是否有开进行判断:
final boolean internalDataEnabled;
internalDataEnabled = mDataEnabledSettings.isInternalDataEnabled();
会对默认数据的sim 的subid进行判断是否为有效的subid.
int dataSub = SubscriptionManager.getDefaultDataSubscriptionId();
boolean defaultDataSelected = SubscriptionManager.isValidSubscriptionId(dataSub);
会对如果当前是漫游状态,漫游数据开关是否有开进行判断.
if (mPhone.getServiceState().getDataRoaming() && !getDataOnRoamingEnabled()) {
if(failureReason == null) return false;
failureReason.addDataAllowFailReason(DataAllowFailReasonType.ROAMING_DISABLED);
}
会对当前的PS是否为Restricted进行判断,mIsPsRestricted值会在消息 EVENT_PS_RESTRICT_ENABLED和 EVENT_PS_RESTRICT_DISABLED中进行赋值.
if (mIsPsRestricted) {
if(failureReason == null) return false;
failureReason.addDataAllowFailReason(DataAllowFailReasonType.PS_RESTRICTED\);
}
会对desiredPowerState和radioStateFromCarrier进行判断
boolean desiredPowerState = mPhone.getServiceStateTracker().getDesiredPowerState();
boolean radioStateFromCarrier = mPhone.getServiceStateTracker().getPowerStateFromCarrier();
int radioTech = mPhone.getServiceState().getRilDataRadioTechnology();
if (radioTech == ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN) {
desiredPowerState = true;
radioStateFromCarrier = true;
}