Fields Summary |
---|
protected static final boolean | DBG |
protected static final boolean | VDBG |
protected static final boolean | VDBG_STALL |
protected static final boolean | RADIO_TESTS |
static boolean | mIsCleanupRequired |
protected static final int | DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVEConstants for the data connection activity:
physical link down/up |
protected static final int | DATA_CONNECTION_ACTIVE_PH_LINK_DOWN |
protected static final int | DATA_CONNECTION_ACTIVE_PH_LINK_UP |
protected static final int | APN_DELAY_DEFAULT_MILLISDelay between APN attempts.
Note the property override mechanism is there just for testing purpose only. |
protected static final int | APN_FAIL_FAST_DELAY_DEFAULT_MILLISDelay between APN attempts when in fail fast mode |
android.app.AlarmManager | mAlarmManager |
protected Object | mDataEnabledLock |
protected boolean | mInternalDataEnabled |
protected boolean | mUserDataEnabled |
protected static boolean | sPolicyDataEnabled |
private boolean[] | mDataEnabled |
private int | mEnabledCount |
protected String | mRequestedApnType |
protected static final String | DEFAULT_DATA_RETRY_CONFIGRetry configuration: A doubling of retry times from 5secs to 30minutes |
protected static final String | SECONDARY_DATA_RETRY_CONFIGRetry configuration for secondary networks: 4 tries in 20 sec |
protected static final int | POLL_NETSTAT_SLOW_MILLISSlow poll when attempting connection recovery. |
protected static final int | DEFAULT_MAX_PDP_RESET_FAILDefault max failure count before attempting to network re-registration. |
protected static final int | NO_RECV_POLL_LIMITAfter detecting a potential connection problem, this is the max number
of subsequent polls before attempting recovery. |
protected static final int | POLL_NETSTAT_MILLIS |
protected static final int | POLL_NETSTAT_SCREEN_OFF_MILLIS |
protected static final int | POLL_LONGEST_RTT |
protected static final int | NUMBER_SENT_PACKETS_OF_HANG |
protected static final int | RESTORE_DEFAULT_APN_DELAY |
protected static final String | APN_RESTORE_DELAY_PROP_NAME |
protected static final String | NULL_IP |
protected static final int | DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS_DEFAULT |
protected static final int | DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS_DEFAULT |
protected static final int | DATA_STALL_NO_RECV_POLL_LIMIT |
protected static final String | DATA_STALL_ALARM_TAG_EXTRA |
protected static final boolean | DATA_STALL_SUSPECTED |
protected static final boolean | DATA_STALL_NOT_SUSPECTED |
protected String | RADIO_RESET_PROPERTY |
protected static final String | INTENT_RECONNECT_ALARM |
protected static final String | INTENT_RECONNECT_ALARM_EXTRA_TYPE |
protected static final String | INTENT_RECONNECT_ALARM_EXTRA_REASON |
protected static final String | INTENT_RESTART_TRYSETUP_ALARM |
protected static final String | INTENT_RESTART_TRYSETUP_ALARM_EXTRA_TYPE |
protected static final String | INTENT_DATA_STALL_ALARM |
protected static final String | DEFALUT_DATA_ON_BOOT_PROP |
protected DcTesterFailBringUpAll | mDcTesterFailBringUpAll |
protected DcController | mDcc |
protected com.android.internal.telephony.PhoneBase | mPhone |
protected com.android.internal.telephony.uicc.UiccController | mUiccController |
protected AtomicReference | mIccRecords |
protected DctConstants.Activity | mActivity |
protected DctConstants.State | mState |
protected android.os.Handler | mDataConnectionTracker |
protected long | mTxPkts |
protected long | mRxPkts |
protected int | mNetStatPollPeriod |
protected boolean | mNetStatPollEnabled |
protected TxRxSum | mDataStallTxRxSum |
protected int | mDataStallAlarmTag |
protected android.app.PendingIntent | mDataStallAlarmIntent |
protected long | mSentSinceLastRecv |
protected int | mNoRecvPollCount |
protected static int | sEnableFailFastRefCounter |
protected volatile boolean | mDataStallDetectionEnabled |
protected volatile boolean | mFailFast |
protected boolean | mInVoiceCall |
protected boolean | mIsWifiConnected |
protected android.app.PendingIntent | mReconnectIntentIntent sent when the reconnect alarm fires. |
protected int | mCidActiveCID of active data connection |
protected boolean | mAutoAttachOnCreationConfig |
protected boolean | mAutoAttachOnCreation |
protected boolean | mIsScreenOn |
protected AtomicInteger | mUniqueIdGeneratorAllows the generation of unique Id's for DataConnection objects |
protected HashMap | mDataConnectionsThe data connections. |
protected HashMap | mDataConnectionAcHashMapThe data connection async channels |
protected HashMap | mApnToDataConnectionIdConvert an ApnType string to Id (TODO: Use "enumeration" instead of String for ApnType) |
protected final ConcurrentHashMap | mApnContextsPhone.APN_TYPE_* ===> ApnContext |
protected final PriorityQueue | mPrioritySortedApnContextskept in sync with mApnContexts
Higher numbers are higher priority and sorted so highest priority is first |
protected ApnSetting | mActiveApn |
protected ArrayList | mAllApnSettingsallApns holds all apns |
protected ApnSetting | mPreferredApnpreferred apn |
protected boolean | mIsPsRestrictedIs packet service restricted by network |
protected ApnSetting | mEmergencyApnemergency apn Setting |
protected boolean | mIsDisposed |
protected android.content.ContentResolver | mResolver |
protected boolean | mIsProvisioning |
protected String | mProvisioningUrl |
protected static final String | INTENT_PROVISIONING_APN_ALARM |
protected static final String | PROVISIONING_APN_ALARM_TAG_EXTRA |
protected static final String | DEBUG_PROV_APN_ALARM |
protected static final int | PROVISIONING_APN_ALARM_DELAY_IN_MS_DEFAULT |
protected android.app.PendingIntent | mProvisioningApnAlarmIntent |
protected int | mProvisioningApnAlarmTag |
protected com.android.internal.util.AsyncChannel | mReplyAc |
protected android.content.BroadcastReceiver | mIntentReceiver |
private Runnable | mPollNetStat |
private android.telephony.SubscriptionManager | mSubscriptionManager |
private final android.telephony.SubscriptionManager.OnSubscriptionsChangedListener | mOnSubscriptionsChangedListener |
private DataRoamingSettingObserver | mDataRoamingSettingObserver |
private static final int | DEFAULT_MDC_INITIAL_RETRYThe Initial MaxRetry sent to a DataConnection as a parameter
to DataConnectionAc.bringUp. This value can be defined at compile
time using the SystemProperty Settings.Global.DCT_INITIAL_MAX_RETRY
and at runtime using gservices to change Settings.Global.DCT_INITIAL_MAX_RETRY. |
android.net.ConnectivityManager | mCm |
Methods Summary |
---|
protected java.lang.String | apnIdToType(int id)
switch (id) {
case DctConstants.APN_DEFAULT_ID:
return PhoneConstants.APN_TYPE_DEFAULT;
case DctConstants.APN_MMS_ID:
return PhoneConstants.APN_TYPE_MMS;
case DctConstants.APN_SUPL_ID:
return PhoneConstants.APN_TYPE_SUPL;
case DctConstants.APN_DUN_ID:
return PhoneConstants.APN_TYPE_DUN;
case DctConstants.APN_HIPRI_ID:
return PhoneConstants.APN_TYPE_HIPRI;
case DctConstants.APN_IMS_ID:
return PhoneConstants.APN_TYPE_IMS;
case DctConstants.APN_FOTA_ID:
return PhoneConstants.APN_TYPE_FOTA;
case DctConstants.APN_CBS_ID:
return PhoneConstants.APN_TYPE_CBS;
case DctConstants.APN_IA_ID:
return PhoneConstants.APN_TYPE_IA;
case DctConstants.APN_EMERGENCY_ID:
return PhoneConstants.APN_TYPE_EMERGENCY;
default:
log("Unknown id (" + id + ") in apnIdToType");
return PhoneConstants.APN_TYPE_DEFAULT;
}
|
protected int | apnTypeToId(java.lang.String type)
if (TextUtils.equals(type, PhoneConstants.APN_TYPE_DEFAULT)) {
return DctConstants.APN_DEFAULT_ID;
} else if (TextUtils.equals(type, PhoneConstants.APN_TYPE_MMS)) {
return DctConstants.APN_MMS_ID;
} else if (TextUtils.equals(type, PhoneConstants.APN_TYPE_SUPL)) {
return DctConstants.APN_SUPL_ID;
} else if (TextUtils.equals(type, PhoneConstants.APN_TYPE_DUN)) {
return DctConstants.APN_DUN_ID;
} else if (TextUtils.equals(type, PhoneConstants.APN_TYPE_HIPRI)) {
return DctConstants.APN_HIPRI_ID;
} else if (TextUtils.equals(type, PhoneConstants.APN_TYPE_IMS)) {
return DctConstants.APN_IMS_ID;
} else if (TextUtils.equals(type, PhoneConstants.APN_TYPE_FOTA)) {
return DctConstants.APN_FOTA_ID;
} else if (TextUtils.equals(type, PhoneConstants.APN_TYPE_CBS)) {
return DctConstants.APN_CBS_ID;
} else if (TextUtils.equals(type, PhoneConstants.APN_TYPE_IA)) {
return DctConstants.APN_IA_ID;
} else if (TextUtils.equals(type, PhoneConstants.APN_TYPE_EMERGENCY)) {
return DctConstants.APN_EMERGENCY_ID;
} else {
return DctConstants.APN_INVALID_ID;
}
|
public void | cleanUpAllConnections(java.lang.String cause)
Message msg = obtainMessage(DctConstants.EVENT_CLEAN_UP_ALL_CONNECTIONS);
msg.obj = cause;
sendMessage(msg);
|
protected abstract void | completeConnection(ApnContext apnContext)
|
public void | decApnRefCount(java.lang.String name)
|
public void | dispose()
if (DBG) log("DCT.dispose");
for (DcAsyncChannel dcac : mDataConnectionAcHashMap.values()) {
dcac.disconnect();
}
mDataConnectionAcHashMap.clear();
mIsDisposed = true;
mPhone.getContext().unregisterReceiver(mIntentReceiver);
mUiccController.unregisterForIccChanged(this);
if (mDataRoamingSettingObserver != null) {
mDataRoamingSettingObserver.unregister();
}
mSubscriptionManager
.removeOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
mDcc.dispose();
mDcTesterFailBringUpAll.dispose();
|
protected void | doRecovery()
if (getOverallState() == DctConstants.State.CONNECTED) {
// Go through a series of recovery steps, each action transitions to the next action
int recoveryAction = getRecoveryAction();
switch (recoveryAction) {
case RecoveryAction.GET_DATA_CALL_LIST:
EventLog.writeEvent(EventLogTags.DATA_STALL_RECOVERY_GET_DATA_CALL_LIST,
mSentSinceLastRecv);
if (DBG) log("doRecovery() get data call list");
mPhone.mCi.getDataCallList(obtainMessage(DctConstants.EVENT_DATA_STATE_CHANGED));
putRecoveryAction(RecoveryAction.CLEANUP);
break;
case RecoveryAction.CLEANUP:
EventLog.writeEvent(EventLogTags.DATA_STALL_RECOVERY_CLEANUP, mSentSinceLastRecv);
if (DBG) log("doRecovery() cleanup all connections");
cleanUpAllConnections(Phone.REASON_PDP_RESET);
putRecoveryAction(RecoveryAction.REREGISTER);
break;
case RecoveryAction.REREGISTER:
EventLog.writeEvent(EventLogTags.DATA_STALL_RECOVERY_REREGISTER,
mSentSinceLastRecv);
if (DBG) log("doRecovery() re-register");
mPhone.getServiceStateTracker().reRegisterNetwork(null);
putRecoveryAction(RecoveryAction.RADIO_RESTART);
break;
case RecoveryAction.RADIO_RESTART:
EventLog.writeEvent(EventLogTags.DATA_STALL_RECOVERY_RADIO_RESTART,
mSentSinceLastRecv);
if (DBG) log("restarting radio");
putRecoveryAction(RecoveryAction.RADIO_RESTART_WITH_PROP);
restartRadio();
break;
case RecoveryAction.RADIO_RESTART_WITH_PROP:
// This is in case radio restart has not recovered the data.
// It will set an additional "gsm.radioreset" property to tell
// RIL or system to take further action.
// The implementation of hard reset recovery action is up to OEM product.
// Once RADIO_RESET property is consumed, it is expected to set back
// to false by RIL.
EventLog.writeEvent(EventLogTags.DATA_STALL_RECOVERY_RADIO_RESTART_WITH_PROP, -1);
if (DBG) log("restarting radio with gsm.radioreset to true");
SystemProperties.set(RADIO_RESET_PROPERTY, "true");
// give 1 sec so property change can be notified.
try {
Thread.sleep(1000);
} catch (InterruptedException e) {}
restartRadio();
putRecoveryAction(RecoveryAction.GET_DATA_CALL_LIST);
break;
default:
throw new RuntimeException("doRecovery: Invalid recoveryAction=" +
recoveryAction);
}
mSentSinceLastRecv = 0;
}
|
public void | dump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)
pw.println("DcTrackerBase:");
pw.println(" RADIO_TESTS=" + RADIO_TESTS);
pw.println(" mInternalDataEnabled=" + mInternalDataEnabled);
pw.println(" mUserDataEnabled=" + mUserDataEnabled);
pw.println(" sPolicyDataEnabed=" + sPolicyDataEnabled);
pw.println(" mDataEnabled:");
for(int i=0; i < mDataEnabled.length; i++) {
pw.printf(" mDataEnabled[%d]=%b\n", i, mDataEnabled[i]);
}
pw.flush();
pw.println(" mEnabledCount=" + mEnabledCount);
pw.println(" mRequestedApnType=" + mRequestedApnType);
pw.println(" mPhone=" + mPhone.getPhoneName());
pw.println(" mActivity=" + mActivity);
pw.println(" mState=" + mState);
pw.println(" mTxPkts=" + mTxPkts);
pw.println(" mRxPkts=" + mRxPkts);
pw.println(" mNetStatPollPeriod=" + mNetStatPollPeriod);
pw.println(" mNetStatPollEnabled=" + mNetStatPollEnabled);
pw.println(" mDataStallTxRxSum=" + mDataStallTxRxSum);
pw.println(" mDataStallAlarmTag=" + mDataStallAlarmTag);
pw.println(" mDataStallDetectionEanbled=" + mDataStallDetectionEnabled);
pw.println(" mSentSinceLastRecv=" + mSentSinceLastRecv);
pw.println(" mNoRecvPollCount=" + mNoRecvPollCount);
pw.println(" mResolver=" + mResolver);
pw.println(" mIsWifiConnected=" + mIsWifiConnected);
pw.println(" mReconnectIntent=" + mReconnectIntent);
pw.println(" mCidActive=" + mCidActive);
pw.println(" mAutoAttachOnCreation=" + mAutoAttachOnCreation);
pw.println(" mIsScreenOn=" + mIsScreenOn);
pw.println(" mUniqueIdGenerator=" + mUniqueIdGenerator);
pw.flush();
pw.println(" ***************************************");
DcController dcc = mDcc;
if (dcc != null) {
dcc.dump(fd, pw, args);
} else {
pw.println(" mDcc=null");
}
pw.println(" ***************************************");
HashMap<Integer, DataConnection> dcs = mDataConnections;
if (dcs != null) {
Set<Entry<Integer, DataConnection> > mDcSet = mDataConnections.entrySet();
pw.println(" mDataConnections: count=" + mDcSet.size());
for (Entry<Integer, DataConnection> entry : mDcSet) {
pw.printf(" *** mDataConnection[%d] \n", entry.getKey());
entry.getValue().dump(fd, pw, args);
}
} else {
pw.println("mDataConnections=null");
}
pw.println(" ***************************************");
pw.flush();
HashMap<String, Integer> apnToDcId = mApnToDataConnectionId;
if (apnToDcId != null) {
Set<Entry<String, Integer>> apnToDcIdSet = apnToDcId.entrySet();
pw.println(" mApnToDataConnectonId size=" + apnToDcIdSet.size());
for (Entry<String, Integer> entry : apnToDcIdSet) {
pw.printf(" mApnToDataConnectonId[%s]=%d\n", entry.getKey(), entry.getValue());
}
} else {
pw.println("mApnToDataConnectionId=null");
}
pw.println(" ***************************************");
pw.flush();
ConcurrentHashMap<String, ApnContext> apnCtxs = mApnContexts;
if (apnCtxs != null) {
Set<Entry<String, ApnContext>> apnCtxsSet = apnCtxs.entrySet();
pw.println(" mApnContexts size=" + apnCtxsSet.size());
for (Entry<String, ApnContext> entry : apnCtxsSet) {
entry.getValue().dump(fd, pw, args);
}
pw.println(" ***************************************");
} else {
pw.println(" mApnContexts=null");
}
pw.flush();
pw.println(" mActiveApn=" + mActiveApn);
ArrayList<ApnSetting> apnSettings = mAllApnSettings;
if (apnSettings != null) {
pw.println(" mAllApnSettings size=" + apnSettings.size());
for (int i=0; i < apnSettings.size(); i++) {
pw.printf(" mAllApnSettings[%d]: %s\n", i, apnSettings.get(i));
}
pw.flush();
} else {
pw.println(" mAllApnSettings=null");
}
pw.println(" mPreferredApn=" + mPreferredApn);
pw.println(" mIsPsRestricted=" + mIsPsRestricted);
pw.println(" mIsDisposed=" + mIsDisposed);
pw.println(" mIntentReceiver=" + mIntentReceiver);
pw.println(" mDataRoamingSettingObserver=" + mDataRoamingSettingObserver);
pw.flush();
|
protected ApnSetting | fetchDunApn()
if (SystemProperties.getBoolean("net.tethering.noprovisioning", false)) {
log("fetchDunApn: net.tethering.noprovisioning=true ret: null");
return null;
}
int bearer = -1;
ApnSetting retDunSetting = null;
String apnData = Settings.Global.getString(mResolver, Settings.Global.TETHER_DUN_APN);
List<ApnSetting> dunSettings = ApnSetting.arrayFromString(apnData);
IccRecords r = mIccRecords.get();
for (ApnSetting dunSetting : dunSettings) {
String operator = (r != null) ? r.getOperatorNumeric() : "";
if (dunSetting.bearer != 0) {
if (bearer == -1) bearer = mPhone.getServiceState().getRilDataRadioTechnology();
if (dunSetting.bearer != bearer) continue;
}
if (dunSetting.numeric.equals(operator)) {
if (dunSetting.hasMvnoParams()) {
if (r != null &&
mvnoMatches(r, dunSetting.mvnoType, dunSetting.mvnoMatchData)) {
if (VDBG) {
log("fetchDunApn: global TETHER_DUN_APN dunSetting=" + dunSetting);
}
return dunSetting;
}
} else {
if (VDBG) log("fetchDunApn: global TETHER_DUN_APN dunSetting=" + dunSetting);
return dunSetting;
}
}
}
Context c = mPhone.getContext();
String[] apnArrayData = c.getResources().getStringArray(R.array.config_tether_apndata);
for (String apn : apnArrayData) {
ApnSetting dunSetting = ApnSetting.fromString(apn);
if (dunSetting != null) {
if (dunSetting.bearer != 0) {
if (bearer == -1) bearer = mPhone.getServiceState().getRilDataRadioTechnology();
if (dunSetting.bearer != bearer) continue;
}
if (dunSetting.hasMvnoParams()) {
if (r != null &&
mvnoMatches(r, dunSetting.mvnoType, dunSetting.mvnoMatchData)) {
if (VDBG) log("fetchDunApn: config_tether_apndata mvno dunSetting="
+ dunSetting);
return dunSetting;
}
} else {
retDunSetting = dunSetting;
}
}
}
if (VDBG) log("fetchDunApn: config_tether_apndata dunSetting=" + retDunSetting);
return retDunSetting;
|
public java.lang.String | getActiveApnString(java.lang.String apnType)TODO: See if we can remove
String result = null;
if (mActiveApn != null) {
result = mActiveApn.apn;
}
return result;
|
public java.lang.String[] | getActiveApnTypes()
String[] result;
if (mActiveApn != null) {
result = mActiveApn.types;
} else {
result = new String[1];
result[0] = PhoneConstants.APN_TYPE_DEFAULT;
}
return result;
|
public DctConstants.Activity | getActivity()
return mActivity;
|
public boolean | getAnyDataEnabled()Report on whether data connectivity is enabled
final boolean result;
synchronized (mDataEnabledLock) {
result = (mInternalDataEnabled && mUserDataEnabled && sPolicyDataEnabled
&& (mEnabledCount != 0));
}
if (!result && DBG) log("getAnyDataEnabled " + result);
return result;
|
public int | getApnPriority(java.lang.String name)
return -1;
|
public boolean | getDataEnabled()Return current {@link android.provider.Settings.Global#MOBILE_DATA} value.
boolean retVal = "true".equalsIgnoreCase(SystemProperties.get(
"ro.com.android.mobiledata", "true"));
try {
if (TelephonyManager.getDefault().getSimCount() == 1) {
retVal = Settings.Global.getInt(mResolver, Settings.Global.MOBILE_DATA,
retVal ? 1 : 0) != 0;
} else {
int phoneSubId = mPhone.getSubId();
retVal = TelephonyManager.getIntWithSubId(mResolver, Settings.Global.MOBILE_DATA,
phoneSubId) != 0;
}
if (DBG) log("getDataEnabled: getIntWithSubId retVal=" + retVal);
} catch (SettingNotFoundException snfe) {
retVal = "true".equalsIgnoreCase(
SystemProperties.get("ro.com.android.mobiledata", "true"));
if (DBG) {
log("getDataEnabled: system property ro.com.android.mobiledata retVal=" + retVal);
}
}
return retVal;
|
public boolean | getDataOnRoamingEnabled()Return current {@link android.provider.Settings.Global#DATA_ROAMING} value.
boolean isDataRoamingEnabled = "true".equalsIgnoreCase(SystemProperties.get(
"ro.com.android.dataroaming", "false"));
final int phoneSubId = mPhone.getSubId();
try {
// For single SIM phones, this is a per phone property.
if (TelephonyManager.getDefault().getSimCount() == 1) {
isDataRoamingEnabled = Settings.Global.getInt(mResolver,
Settings.Global.DATA_ROAMING, isDataRoamingEnabled ? 1 : 0) != 0;
} else {
isDataRoamingEnabled = TelephonyManager.getIntWithSubId(mResolver,
Settings.Global.DATA_ROAMING, phoneSubId) != 0;
}
} catch (SettingNotFoundException snfe) {
if (DBG) log("getDataOnRoamingEnabled: SettingNofFoundException snfe=" + snfe);
}
if (DBG) {
log("getDataOnRoamingEnabled: phoneSubId=" + phoneSubId +
" isDataRoamingEnabled=" + isDataRoamingEnabled);
}
return isDataRoamingEnabled;
|
protected int | getInitialMaxRetry()
if (mFailFast) {
return 0;
}
// Get default value from system property or use DEFAULT_MDC_INITIAL_RETRY
int value = SystemProperties.getInt(
Settings.Global.MDC_INITIAL_MAX_RETRY, DEFAULT_MDC_INITIAL_RETRY);
// Check if its been overridden
return Settings.Global.getInt(mResolver,
Settings.Global.MDC_INITIAL_MAX_RETRY, value);
|
public android.net.LinkProperties | getLinkProperties(java.lang.String apnType)
int id = apnTypeToId(apnType);
if (isApnIdEnabled(id)) {
DcAsyncChannel dcac = mDataConnectionAcHashMap.get(0);
return dcac.getLinkPropertiesSync();
} else {
return new LinkProperties();
}
|
public android.net.NetworkCapabilities | getNetworkCapabilities(java.lang.String apnType)
int id = apnTypeToId(apnType);
if (isApnIdEnabled(id)) {
DcAsyncChannel dcac = mDataConnectionAcHashMap.get(0);
return dcac.getNetworkCapabilitiesSync();
} else {
return new NetworkCapabilities();
}
|
protected abstract DctConstants.State | getOverallState()
|
public abstract java.lang.String[] | getPcscfAddress(java.lang.String apnType)
|
public int | getRecoveryAction()
int action = Settings.System.getInt(mResolver,
"radio.data.stall.recovery.action", RecoveryAction.GET_DATA_CALL_LIST);
if (VDBG_STALL) log("getRecoveryAction: " + action);
return action;
|
protected java.lang.String | getReryConfig(boolean forDefault)
int nt = mPhone.getServiceState().getNetworkType();
if ((nt == TelephonyManager.NETWORK_TYPE_CDMA) ||
(nt == TelephonyManager.NETWORK_TYPE_1xRTT) ||
(nt == TelephonyManager.NETWORK_TYPE_EVDO_0) ||
(nt == TelephonyManager.NETWORK_TYPE_EVDO_A) ||
(nt == TelephonyManager.NETWORK_TYPE_EVDO_B) ||
(nt == TelephonyManager.NETWORK_TYPE_EHRPD)) {
// CDMA variant
return SystemProperties.get("ro.cdma.data_retry_config");
} else {
// Use GSM varient for all others.
if (forDefault) {
return SystemProperties.get("ro.gsm.data_retry_config");
} else {
return SystemProperties.get("ro.gsm.2nd_data_retry_config");
}
}
|
public abstract DctConstants.State | getState(java.lang.String apnType)
|
public long | getSubId()
return mPhone.getSubId();
|
protected abstract void | gotoIdleAndNotifyDataConnection(java.lang.String reason)
|
public void | handleMessage(android.os.Message msg)
switch (msg.what) {
case AsyncChannel.CMD_CHANNEL_DISCONNECTED: {
log("DISCONNECTED_CONNECTED: msg=" + msg);
DcAsyncChannel dcac = (DcAsyncChannel) msg.obj;
mDataConnectionAcHashMap.remove(dcac.getDataConnectionIdSync());
dcac.disconnected();
break;
}
case DctConstants.EVENT_ENABLE_NEW_APN:
onEnableApn(msg.arg1, msg.arg2);
break;
case DctConstants.EVENT_TRY_SETUP_DATA:
String reason = null;
if (msg.obj instanceof String) {
reason = (String) msg.obj;
}
onTrySetupData(reason);
break;
case DctConstants.EVENT_DATA_STALL_ALARM:
onDataStallAlarm(msg.arg1);
break;
case DctConstants.EVENT_ROAMING_OFF:
onRoamingOff();
break;
case DctConstants.EVENT_ROAMING_ON:
onRoamingOn();
break;
case DctConstants.EVENT_RADIO_AVAILABLE:
onRadioAvailable();
break;
case DctConstants.EVENT_RADIO_OFF_OR_NOT_AVAILABLE:
onRadioOffOrNotAvailable();
break;
case DctConstants.EVENT_DATA_SETUP_COMPLETE:
mCidActive = msg.arg1;
onDataSetupComplete((AsyncResult) msg.obj);
break;
case DctConstants.EVENT_DATA_SETUP_COMPLETE_ERROR:
onDataSetupCompleteError((AsyncResult) msg.obj);
break;
case DctConstants.EVENT_DISCONNECT_DONE:
log("DataConnectionTracker.handleMessage: EVENT_DISCONNECT_DONE msg=" + msg);
onDisconnectDone(msg.arg1, (AsyncResult) msg.obj);
break;
case DctConstants.EVENT_DISCONNECT_DC_RETRYING:
log("DataConnectionTracker.handleMessage: EVENT_DISCONNECT_DC_RETRYING msg=" + msg);
onDisconnectDcRetrying(msg.arg1, (AsyncResult) msg.obj);
break;
case DctConstants.EVENT_VOICE_CALL_STARTED:
onVoiceCallStarted();
break;
case DctConstants.EVENT_VOICE_CALL_ENDED:
onVoiceCallEnded();
break;
case DctConstants.EVENT_CLEAN_UP_ALL_CONNECTIONS: {
onCleanUpAllConnections((String) msg.obj);
break;
}
case DctConstants.EVENT_CLEAN_UP_CONNECTION: {
boolean tearDown = (msg.arg1 == 0) ? false : true;
onCleanUpConnection(tearDown, msg.arg2, (String) msg.obj);
break;
}
case DctConstants.EVENT_SET_INTERNAL_DATA_ENABLE: {
boolean enabled = (msg.arg1 == DctConstants.ENABLED) ? true : false;
onSetInternalDataEnabled(enabled);
break;
}
case DctConstants.EVENT_RESET_DONE: {
if (DBG) log("EVENT_RESET_DONE");
onResetDone((AsyncResult) msg.obj);
break;
}
case DctConstants.CMD_SET_USER_DATA_ENABLE: {
final boolean enabled = (msg.arg1 == DctConstants.ENABLED) ? true : false;
if (DBG) log("CMD_SET_USER_DATA_ENABLE enabled=" + enabled);
onSetUserDataEnabled(enabled);
break;
}
case DctConstants.CMD_SET_DEPENDENCY_MET: {
boolean met = (msg.arg1 == DctConstants.ENABLED) ? true : false;
if (DBG) log("CMD_SET_DEPENDENCY_MET met=" + met);
Bundle bundle = msg.getData();
if (bundle != null) {
String apnType = (String)bundle.get(DctConstants.APN_TYPE_KEY);
if (apnType != null) {
onSetDependencyMet(apnType, met);
}
}
break;
}
case DctConstants.CMD_SET_POLICY_DATA_ENABLE: {
final boolean enabled = (msg.arg1 == DctConstants.ENABLED) ? true : false;
onSetPolicyDataEnabled(enabled);
break;
}
case DctConstants.CMD_SET_ENABLE_FAIL_FAST_MOBILE_DATA: {
sEnableFailFastRefCounter += (msg.arg1 == DctConstants.ENABLED) ? 1 : -1;
if (DBG) {
log("CMD_SET_ENABLE_FAIL_FAST_MOBILE_DATA: "
+ " sEnableFailFastRefCounter=" + sEnableFailFastRefCounter);
}
if (sEnableFailFastRefCounter < 0) {
final String s = "CMD_SET_ENABLE_FAIL_FAST_MOBILE_DATA: "
+ "sEnableFailFastRefCounter:" + sEnableFailFastRefCounter + " < 0";
loge(s);
sEnableFailFastRefCounter = 0;
}
final boolean enabled = sEnableFailFastRefCounter > 0;
if (DBG) {
log("CMD_SET_ENABLE_FAIL_FAST_MOBILE_DATA: enabled=" + enabled
+ " sEnableFailFastRefCounter=" + sEnableFailFastRefCounter);
}
if (mFailFast != enabled) {
mFailFast = enabled;
mDataStallDetectionEnabled = !enabled;
if (mDataStallDetectionEnabled
&& (getOverallState() == DctConstants.State.CONNECTED)
&& (!mInVoiceCall ||
mPhone.getServiceStateTracker()
.isConcurrentVoiceAndDataAllowed())) {
if (DBG) log("CMD_SET_ENABLE_FAIL_FAST_MOBILE_DATA: start data stall");
stopDataStallAlarm();
startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
} else {
if (DBG) log("CMD_SET_ENABLE_FAIL_FAST_MOBILE_DATA: stop data stall");
stopDataStallAlarm();
}
}
break;
}
case DctConstants.CMD_ENABLE_MOBILE_PROVISIONING: {
Bundle bundle = msg.getData();
if (bundle != null) {
try {
mProvisioningUrl = (String)bundle.get(DctConstants.PROVISIONING_URL_KEY);
} catch(ClassCastException e) {
loge("CMD_ENABLE_MOBILE_PROVISIONING: provisioning url not a string" + e);
mProvisioningUrl = null;
}
}
if (TextUtils.isEmpty(mProvisioningUrl)) {
loge("CMD_ENABLE_MOBILE_PROVISIONING: provisioning url is empty, ignoring");
mIsProvisioning = false;
mProvisioningUrl = null;
} else {
loge("CMD_ENABLE_MOBILE_PROVISIONING: provisioningUrl=" + mProvisioningUrl);
mIsProvisioning = true;
startProvisioningApnAlarm();
}
break;
}
case DctConstants.EVENT_PROVISIONING_APN_ALARM: {
if (DBG) log("EVENT_PROVISIONING_APN_ALARM");
ApnContext apnCtx = mApnContexts.get("default");
if (apnCtx.isProvisioningApn() && apnCtx.isConnectedOrConnecting()) {
if (mProvisioningApnAlarmTag == msg.arg1) {
if (DBG) log("EVENT_PROVISIONING_APN_ALARM: Disconnecting");
mIsProvisioning = false;
mProvisioningUrl = null;
stopProvisioningApnAlarm();
sendCleanUpConnection(true, apnCtx);
} else {
if (DBG) {
log("EVENT_PROVISIONING_APN_ALARM: ignore stale tag,"
+ " mProvisioningApnAlarmTag:" + mProvisioningApnAlarmTag
+ " != arg1:" + msg.arg1);
}
}
} else {
if (DBG) log("EVENT_PROVISIONING_APN_ALARM: Not connected ignore");
}
break;
}
case DctConstants.CMD_IS_PROVISIONING_APN: {
if (DBG) log("CMD_IS_PROVISIONING_APN");
boolean isProvApn;
try {
String apnType = null;
Bundle bundle = msg.getData();
if (bundle != null) {
apnType = (String)bundle.get(DctConstants.APN_TYPE_KEY);
}
if (TextUtils.isEmpty(apnType)) {
loge("CMD_IS_PROVISIONING_APN: apnType is empty");
isProvApn = false;
} else {
isProvApn = isProvisioningApn(apnType);
}
} catch (ClassCastException e) {
loge("CMD_IS_PROVISIONING_APN: NO provisioning url ignoring");
isProvApn = false;
}
if (DBG) log("CMD_IS_PROVISIONING_APN: ret=" + isProvApn);
mReplyAc.replyToMessage(msg, DctConstants.CMD_IS_PROVISIONING_APN,
isProvApn ? DctConstants.ENABLED : DctConstants.DISABLED);
break;
}
case DctConstants.EVENT_ICC_CHANGED: {
onUpdateIcc();
break;
}
case DctConstants.EVENT_RESTART_RADIO: {
restartRadio();
break;
}
case DctConstants.CMD_NET_STAT_POLL: {
if (msg.arg1 == DctConstants.ENABLED) {
handleStartNetStatPoll((DctConstants.Activity)msg.obj);
} else if (msg.arg1 == DctConstants.DISABLED) {
handleStopNetStatPoll((DctConstants.Activity)msg.obj);
}
break;
}
default:
Rlog.e("DATA", "Unidentified event msg=" + msg);
break;
}
|
protected void | handleStartNetStatPoll(DctConstants.Activity activity)
startNetStatPoll();
startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
setActivity(activity);
|
protected void | handleStopNetStatPoll(DctConstants.Activity activity)
stopNetStatPoll();
stopDataStallAlarm();
setActivity(activity);
|
public boolean | hasMatchedTetherApnSetting()
ApnSetting matched = fetchDunApn();
log("hasMatchedTetherApnSetting: APN=" + matched);
return matched != null;
|
public void | incApnRefCount(java.lang.String name)
|
protected synchronized boolean | isApnIdEnabled(int id)
if (id != DctConstants.APN_INVALID_ID) {
return mDataEnabled[id];
}
return false;
|
public boolean | isApnSupported(java.lang.String name)
return false;
|
public boolean | isApnTypeActive(java.lang.String type)
// TODO: support simultaneous with List instead
if (PhoneConstants.APN_TYPE_DUN.equals(type)) {
ApnSetting dunApn = fetchDunApn();
if (dunApn != null) {
return ((mActiveApn != null) && (dunApn.toString().equals(mActiveApn.toString())));
}
}
return mActiveApn != null && mActiveApn.canHandleType(type);
|
protected abstract boolean | isApnTypeAvailable(java.lang.String type)
|
public boolean | isApnTypeEnabled(java.lang.String apnType)
if (apnType == null) {
return false;
} else {
return isApnIdEnabled(apnTypeToId(apnType));
}
|
protected boolean | isConnected()
return false;
|
protected abstract boolean | isDataAllowed()
|
public abstract boolean | isDataPossible(java.lang.String apnType)
|
public abstract boolean | isDisconnected()
|
protected boolean | isEmergency()
final boolean result;
synchronized (mDataEnabledLock) {
result = mPhone.isInEcm() || mPhone.isInEmergencyCall();
}
log("isEmergency: result=" + result);
return result;
|
protected abstract boolean | isPermanentFail(DcFailCause dcFailCause)
|
protected abstract boolean | isProvisioningApn(java.lang.String apnType)
|
protected abstract void | log(java.lang.String s)
|
protected abstract void | loge(java.lang.String s)
|
protected abstract boolean | mvnoMatches(com.android.internal.telephony.uicc.IccRecords r, java.lang.String mvno_type, java.lang.String mvno_match_data)
|
private void | notifyApnIdDisconnected(java.lang.String reason, int apnId)
mPhone.notifyDataConnection(reason, apnIdToType(apnId),
PhoneConstants.DataState.DISCONNECTED);
|
private void | notifyApnIdUpToCurrent(java.lang.String reason, int apnId)
switch (mState) {
case IDLE:
break;
case RETRYING:
case CONNECTING:
case SCANNING:
mPhone.notifyDataConnection(reason, apnIdToType(apnId),
PhoneConstants.DataState.CONNECTING);
break;
case CONNECTED:
case DISCONNECTING:
mPhone.notifyDataConnection(reason, apnIdToType(apnId),
PhoneConstants.DataState.CONNECTING);
mPhone.notifyDataConnection(reason, apnIdToType(apnId),
PhoneConstants.DataState.CONNECTED);
break;
default:
// Ignore
break;
}
|
protected void | notifyDataConnection(java.lang.String reason)
for (int id = 0; id < DctConstants.APN_NUM_TYPES; id++) {
if (mDataEnabled[id]) {
mPhone.notifyDataConnection(reason, apnIdToType(id));
}
}
notifyOffApnsOfAvailability(reason);
|
protected void | notifyOffApnsOfAvailability(java.lang.String reason)
if (DBG) log("notifyOffApnsOfAvailability - reason= " + reason);
for (int id = 0; id < DctConstants.APN_NUM_TYPES; id++) {
if (!isApnIdEnabled(id)) {
notifyApnIdDisconnected(reason, id);
}
}
|
protected void | onActionIntentDataStallAlarm(android.content.Intent intent)
if (VDBG_STALL) log("onActionIntentDataStallAlarm: action=" + intent.getAction());
Message msg = obtainMessage(DctConstants.EVENT_DATA_STALL_ALARM,
intent.getAction());
msg.arg1 = intent.getIntExtra(DATA_STALL_ALARM_TAG_EXTRA, 0);
sendMessage(msg);
|
protected void | onActionIntentProvisioningApnAlarm(android.content.Intent intent)
if (DBG) log("onActionIntentProvisioningApnAlarm: action=" + intent.getAction());
Message msg = obtainMessage(DctConstants.EVENT_PROVISIONING_APN_ALARM,
intent.getAction());
msg.arg1 = intent.getIntExtra(PROVISIONING_APN_ALARM_TAG_EXTRA, 0);
sendMessage(msg);
|
protected void | onActionIntentReconnectAlarm(android.content.Intent intent)
String reason = intent.getStringExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON);
String apnType = intent.getStringExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE);
int phoneSubId = mPhone.getSubId();
int currSubId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
log("onActionIntentReconnectAlarm: currSubId = " + currSubId + " phoneSubId=" + phoneSubId);
// Stop reconnect if not current subId is not correct.
// FIXME STOPSHIP - phoneSubId is coming up as -1 way after boot and failing this?
if (!SubscriptionManager.isValidSubscriptionId(currSubId) || (currSubId != phoneSubId)) {
log("receive ReconnectAlarm but subId incorrect, ignore");
return;
}
ApnContext apnContext = mApnContexts.get(apnType);
if (DBG) {
log("onActionIntentReconnectAlarm: mState=" + mState + " reason=" + reason +
" apnType=" + apnType + " apnContext=" + apnContext +
" mDataConnectionAsyncChannels=" + mDataConnectionAcHashMap);
}
if ((apnContext != null) && (apnContext.isEnabled())) {
apnContext.setReason(reason);
DctConstants.State apnContextState = apnContext.getState();
if (DBG) {
log("onActionIntentReconnectAlarm: apnContext state=" + apnContextState);
}
if ((apnContextState == DctConstants.State.FAILED)
|| (apnContextState == DctConstants.State.IDLE)) {
if (DBG) {
log("onActionIntentReconnectAlarm: state is FAILED|IDLE, disassociate");
}
DcAsyncChannel dcac = apnContext.getDcAc();
if (dcac != null) {
if (DBG) {
log("onActionIntentReconnectAlarm: tearDown apnContext=" + apnContext);
}
dcac.tearDown(apnContext, "", null);
}
apnContext.setDataConnectionAc(null);
apnContext.setState(DctConstants.State.IDLE);
} else {
if (DBG) log("onActionIntentReconnectAlarm: keep associated");
}
// TODO: IF already associated should we send the EVENT_TRY_SETUP_DATA???
sendMessage(obtainMessage(DctConstants.EVENT_TRY_SETUP_DATA, apnContext));
apnContext.setReconnectIntent(null);
}
|
protected void | onActionIntentRestartTrySetupAlarm(android.content.Intent intent)
String apnType = intent.getStringExtra(INTENT_RESTART_TRYSETUP_ALARM_EXTRA_TYPE);
ApnContext apnContext = mApnContexts.get(apnType);
if (DBG) {
log("onActionIntentRestartTrySetupAlarm: mState=" + mState +
" apnType=" + apnType + " apnContext=" + apnContext +
" mDataConnectionAsyncChannels=" + mDataConnectionAcHashMap);
}
sendMessage(obtainMessage(DctConstants.EVENT_TRY_SETUP_DATA, apnContext));
|
protected abstract void | onCleanUpAllConnections(java.lang.String cause)
|
protected abstract void | onCleanUpConnection(boolean tearDown, int apnId, java.lang.String reason)
|
protected abstract void | onDataSetupComplete(android.os.AsyncResult ar)
|
protected abstract void | onDataSetupCompleteError(android.os.AsyncResult ar)
|
protected void | onDataStallAlarm(int tag)
if (mDataStallAlarmTag != tag) {
if (DBG) {
log("onDataStallAlarm: ignore, tag=" + tag + " expecting " + mDataStallAlarmTag);
}
return;
}
updateDataStallInfo();
int hangWatchdogTrigger = Settings.Global.getInt(mResolver,
Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT,
NUMBER_SENT_PACKETS_OF_HANG);
boolean suspectedStall = DATA_STALL_NOT_SUSPECTED;
if (mSentSinceLastRecv >= hangWatchdogTrigger) {
if (DBG) {
log("onDataStallAlarm: tag=" + tag + " do recovery action=" + getRecoveryAction());
}
suspectedStall = DATA_STALL_SUSPECTED;
sendMessage(obtainMessage(DctConstants.EVENT_DO_RECOVERY));
} else {
if (VDBG_STALL) {
log("onDataStallAlarm: tag=" + tag + " Sent " + String.valueOf(mSentSinceLastRecv) +
" pkts since last received, < watchdogTrigger=" + hangWatchdogTrigger);
}
}
startDataStallAlarm(suspectedStall);
|
protected abstract void | onDisconnectDcRetrying(int connId, android.os.AsyncResult ar)
|
protected abstract void | onDisconnectDone(int connId, android.os.AsyncResult ar)
|
protected void | onEnableApn(int apnId, int enabled)
if (DBG) {
log("EVENT_APN_ENABLE_REQUEST apnId=" + apnId + ", apnType=" + apnIdToType(apnId) +
", enabled=" + enabled + ", dataEnabled = " + mDataEnabled[apnId] +
", enabledCount = " + mEnabledCount + ", isApnTypeActive = " +
isApnTypeActive(apnIdToType(apnId)));
}
if (enabled == DctConstants.ENABLED) {
synchronized (this) {
if (!mDataEnabled[apnId]) {
mDataEnabled[apnId] = true;
mEnabledCount++;
}
}
String type = apnIdToType(apnId);
if (!isApnTypeActive(type)) {
mRequestedApnType = type;
onEnableNewApn();
} else {
notifyApnIdUpToCurrent(Phone.REASON_APN_SWITCHED, apnId);
}
} else {
// disable
boolean didDisable = false;
synchronized (this) {
if (mDataEnabled[apnId]) {
mDataEnabled[apnId] = false;
mEnabledCount--;
didDisable = true;
}
}
if (didDisable) {
if ((mEnabledCount == 0) || (apnId == DctConstants.APN_DUN_ID)) {
mRequestedApnType = PhoneConstants.APN_TYPE_DEFAULT;
onCleanUpConnection(true, apnId, Phone.REASON_DATA_DISABLED);
}
// send the disconnect msg manually, since the normal route wont send
// it (it's not enabled)
notifyApnIdDisconnected(Phone.REASON_DATA_DISABLED, apnId);
if (mDataEnabled[DctConstants.APN_DEFAULT_ID] == true
&& !isApnTypeActive(PhoneConstants.APN_TYPE_DEFAULT)) {
// TODO - this is an ugly way to restore the default conn - should be done
// by a real contention manager and policy that disconnects the lower pri
// stuff as enable requests come in and pops them back on as we disable back
// down to the lower pri stuff
mRequestedApnType = PhoneConstants.APN_TYPE_DEFAULT;
onEnableNewApn();
}
}
}
|
protected void | onEnableNewApn()Called when we switch APNs.
mRequestedApnType is set prior to call
To be overridden.
|
protected abstract void | onRadioAvailable()
|
protected abstract void | onRadioOffOrNotAvailable()
|
protected void | onResetDone(android.os.AsyncResult ar)Called when EVENT_RESET_DONE is received so goto
IDLE state and send notifications to those interested.
TODO - currently unused. Needs to be hooked into DataConnection cleanup
TODO - needs to pass some notion of which connection is reset..
if (DBG) log("EVENT_RESET_DONE");
String reason = null;
if (ar.userObj instanceof String) {
reason = (String) ar.userObj;
}
gotoIdleAndNotifyDataConnection(reason);
|
protected abstract void | onRoamingOff()
|
protected abstract void | onRoamingOn()
|
protected void | onSetDependencyMet(java.lang.String apnType, boolean met)
|
protected void | onSetInternalDataEnabled(boolean enabled)
synchronized (mDataEnabledLock) {
mInternalDataEnabled = enabled;
if (enabled) {
log("onSetInternalDataEnabled: changed to enabled, try to setup data call");
onTrySetupData(Phone.REASON_DATA_ENABLED);
} else {
log("onSetInternalDataEnabled: changed to disabled, cleanUpAllConnections");
cleanUpAllConnections(null);
}
}
|
protected void | onSetPolicyDataEnabled(boolean enabled)
synchronized (mDataEnabledLock) {
final boolean prevEnabled = getAnyDataEnabled();
if (sPolicyDataEnabled != enabled) {
sPolicyDataEnabled = enabled;
if (prevEnabled != getAnyDataEnabled()) {
if (!prevEnabled) {
onTrySetupData(Phone.REASON_DATA_ENABLED);
} else {
onCleanUpAllConnections(Phone.REASON_DATA_SPECIFIC_DISABLED);
}
}
}
}
|
protected void | onSetUserDataEnabled(boolean enabled)
synchronized (mDataEnabledLock) {
if (mUserDataEnabled != enabled) {
mUserDataEnabled = enabled;
// For single SIM phones, this is a per phone property.
if (TelephonyManager.getDefault().getSimCount() == 1) {
Settings.Global.putInt(mResolver, Settings.Global.MOBILE_DATA, enabled ? 1 : 0);
} else {
int phoneSubId = mPhone.getSubId();
Settings.Global.putInt(mResolver, Settings.Global.MOBILE_DATA + phoneSubId,
enabled ? 1 : 0);
}
if (getDataOnRoamingEnabled() == false &&
mPhone.getServiceState().getDataRoaming() == true) {
if (enabled) {
notifyOffApnsOfAvailability(Phone.REASON_ROAMING_ON);
} else {
notifyOffApnsOfAvailability(Phone.REASON_DATA_DISABLED);
}
}
if (enabled) {
onTrySetupData(Phone.REASON_DATA_ENABLED);
} else {
onCleanUpAllConnections(Phone.REASON_DATA_SPECIFIC_DISABLED);
}
}
}
|
protected abstract boolean | onTrySetupData(java.lang.String reason)
|
protected abstract void | onUpdateIcc()
|
protected abstract void | onVoiceCallEnded()
|
protected abstract void | onVoiceCallStarted()
|
public void | putRecoveryAction(int action)
Settings.System.putInt(mResolver, "radio.data.stall.recovery.action", action);
if (VDBG_STALL) log("putRecoveryAction: " + action);
|
protected void | resetPollStats()
mTxPkts = -1;
mRxPkts = -1;
mNetStatPollPeriod = POLL_NETSTAT_MILLIS;
|
protected void | restartDataStallAlarm()
if (isConnected() == false) return;
// To be called on screen status change.
// Do not cancel the alarm if it is set with aggressive timeout.
int nextAction = getRecoveryAction();
if (RecoveryAction.isAggressiveRecovery(nextAction)) {
if (DBG) log("restartDataStallAlarm: action is pending. not resetting the alarm.");
return;
}
if (VDBG_STALL) log("restartDataStallAlarm: stop then start.");
stopDataStallAlarm();
startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
|
protected abstract void | restartRadio()
|
void | sendCleanUpConnection(boolean tearDown, ApnContext apnContext)
if (DBG)log("sendCleanUpConnection: tearDown=" + tearDown + " apnContext=" + apnContext);
Message msg = obtainMessage(DctConstants.EVENT_CLEAN_UP_CONNECTION);
msg.arg1 = tearDown ? 1 : 0;
msg.arg2 = 0;
msg.obj = apnContext;
sendMessage(msg);
|
void | sendRestartRadio()
if (DBG)log("sendRestartRadio:");
Message msg = obtainMessage(DctConstants.EVENT_RESTART_RADIO);
sendMessage(msg);
|
public void | sendStartNetStatPoll(DctConstants.Activity activity)
Message msg = obtainMessage(DctConstants.CMD_NET_STAT_POLL);
msg.arg1 = DctConstants.ENABLED;
msg.obj = activity;
sendMessage(msg);
|
public void | sendStopNetStatPoll(DctConstants.Activity activity)
Message msg = obtainMessage(DctConstants.CMD_NET_STAT_POLL);
msg.arg1 = DctConstants.DISABLED;
msg.obj = activity;
sendMessage(msg);
|
void | setActivity(DctConstants.Activity activity)
log("setActivity = " + activity);
mActivity = activity;
mPhone.notifyDataActivity();
|
public abstract void | setDataAllowed(boolean enable, android.os.Message response)
|
public void | setDataEnabled(boolean enable)Modify {@link android.provider.Settings.Global#MOBILE_DATA} value.
Message msg = obtainMessage(DctConstants.CMD_SET_USER_DATA_ENABLE);
msg.arg1 = enable ? 1 : 0;
if (DBG) log("setDataEnabled: sendMessage: enable=" + enable);
sendMessage(msg);
|
public void | setDataOnRoamingEnabled(boolean enabled)Modify {@link android.provider.Settings.Global#DATA_ROAMING} value.
final int phoneSubId = mPhone.getSubId();
if (getDataOnRoamingEnabled() != enabled) {
int roaming = enabled ? 1 : 0;
// For single SIM phones, this is a per phone property.
if (TelephonyManager.getDefault().getSimCount() == 1) {
Settings.Global.putInt(mResolver, Settings.Global.DATA_ROAMING, roaming);
} else {
Settings.Global.putInt(mResolver, Settings.Global.DATA_ROAMING + phoneSubId, roaming);
}
mSubscriptionManager.setDataRoaming(roaming, phoneSubId);
// will trigger handleDataOnRoamingChange() through observer
if (DBG) {
log("setDataOnRoamingEnabled: set phoneSubId=" + phoneSubId
+ " isRoaming=" + enabled);
}
} else {
if (DBG) {
log("setDataOnRoamingEnabled: unchanged phoneSubId=" + phoneSubId
+ " isRoaming=" + enabled);
}
}
|
protected void | setDataProfilesAsNeeded()
if (DBG) log("setDataProfilesAsNeeded");
if (mAllApnSettings != null && !mAllApnSettings.isEmpty()) {
ArrayList<DataProfile> dps = new ArrayList<DataProfile>();
for (ApnSetting apn : mAllApnSettings) {
if (apn.modemCognitive) {
DataProfile dp = new DataProfile(apn,
mPhone.getServiceState().getDataRoaming());
boolean isDup = false;
for(DataProfile dpIn : dps) {
if (dp.equals(dpIn)) {
isDup = true;
break;
}
}
if (!isDup) {
dps.add(dp);
}
}
}
if(dps.size() > 0) {
mPhone.mCi.setDataProfile(dps.toArray(new DataProfile[0]), null);
}
}
|
protected void | setEnabled(int id, boolean enable)
if (DBG) {
log("setEnabled(" + id + ", " + enable + ") with old state = " + mDataEnabled[id]
+ " and enabledCount = " + mEnabledCount);
}
Message msg = obtainMessage(DctConstants.EVENT_ENABLE_NEW_APN);
msg.arg1 = id;
msg.arg2 = (enable ? DctConstants.ENABLED : DctConstants.DISABLED);
sendMessage(msg);
|
public abstract void | setImsRegistrationState(boolean registered)
|
protected void | setInitialAttachApn()
ApnSetting iaApnSetting = null;
ApnSetting defaultApnSetting = null;
ApnSetting firstApnSetting = null;
log("setInitialApn: E mPreferredApn=" + mPreferredApn);
if (mAllApnSettings != null && !mAllApnSettings.isEmpty()) {
firstApnSetting = mAllApnSettings.get(0);
log("setInitialApn: firstApnSetting=" + firstApnSetting);
// Search for Initial APN setting and the first apn that can handle default
for (ApnSetting apn : mAllApnSettings) {
// Can't use apn.canHandleType(), as that returns true for APNs that have no type.
if (ArrayUtils.contains(apn.types, PhoneConstants.APN_TYPE_IA) &&
apn.carrierEnabled) {
// The Initial Attach APN is highest priority so use it if there is one
log("setInitialApn: iaApnSetting=" + apn);
iaApnSetting = apn;
break;
} else if ((defaultApnSetting == null)
&& (apn.canHandleType(PhoneConstants.APN_TYPE_DEFAULT))) {
// Use the first default apn if no better choice
log("setInitialApn: defaultApnSetting=" + apn);
defaultApnSetting = apn;
}
}
}
// The priority of apn candidates from highest to lowest is:
// 1) APN_TYPE_IA (Inital Attach)
// 2) mPreferredApn, i.e. the current preferred apn
// 3) The first apn that than handle APN_TYPE_DEFAULT
// 4) The first APN we can find.
ApnSetting initialAttachApnSetting = null;
if (iaApnSetting != null) {
if (DBG) log("setInitialAttachApn: using iaApnSetting");
initialAttachApnSetting = iaApnSetting;
} else if (mPreferredApn != null) {
if (DBG) log("setInitialAttachApn: using mPreferredApn");
initialAttachApnSetting = mPreferredApn;
} else if (defaultApnSetting != null) {
if (DBG) log("setInitialAttachApn: using defaultApnSetting");
initialAttachApnSetting = defaultApnSetting;
} else if (firstApnSetting != null) {
if (DBG) log("setInitialAttachApn: using firstApnSetting");
initialAttachApnSetting = firstApnSetting;
}
if (initialAttachApnSetting == null) {
if (DBG) log("setInitialAttachApn: X There in no available apn");
} else {
if (DBG) log("setInitialAttachApn: X selected Apn=" + initialAttachApnSetting);
mPhone.mCi.setInitialAttachApn(initialAttachApnSetting.apn,
initialAttachApnSetting.protocol, initialAttachApnSetting.authType,
initialAttachApnSetting.user, initialAttachApnSetting.password, null);
}
|
public boolean | setInternalDataEnabled(boolean enable)Prevent mobile data connections from being established, or once again
allow mobile data connections. If the state toggles, then either tear
down or set up data, as appropriate to match the new state.
if (DBG)
log("setInternalDataEnabled(" + enable + ")");
Message msg = obtainMessage(DctConstants.EVENT_SET_INTERNAL_DATA_ENABLE);
msg.arg1 = (enable ? DctConstants.ENABLED : DctConstants.DISABLED);
sendMessage(msg);
return true;
|
protected abstract void | setState(DctConstants.State s)
|
protected void | startDataStallAlarm(boolean suspectedStall)
int nextAction = getRecoveryAction();
int delayInMs;
if (mDataStallDetectionEnabled && getOverallState() == DctConstants.State.CONNECTED) {
// If screen is on or data stall is currently suspected, set the alarm
// with an aggresive timeout.
if (mIsScreenOn || suspectedStall || RecoveryAction.isAggressiveRecovery(nextAction)) {
delayInMs = Settings.Global.getInt(mResolver,
Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS,
DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS_DEFAULT);
} else {
delayInMs = Settings.Global.getInt(mResolver,
Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS,
DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS_DEFAULT);
}
mDataStallAlarmTag += 1;
if (VDBG_STALL) {
log("startDataStallAlarm: tag=" + mDataStallAlarmTag +
" delay=" + (delayInMs / 1000) + "s");
}
Intent intent = new Intent(INTENT_DATA_STALL_ALARM);
intent.putExtra(DATA_STALL_ALARM_TAG_EXTRA, mDataStallAlarmTag);
mDataStallAlarmIntent = PendingIntent.getBroadcast(mPhone.getContext(), 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + delayInMs, mDataStallAlarmIntent);
} else {
if (VDBG_STALL) {
log("startDataStallAlarm: NOT started, no connection tag=" + mDataStallAlarmTag);
}
}
|
void | startNetStatPoll()
if (getOverallState() == DctConstants.State.CONNECTED
&& mNetStatPollEnabled == false) {
if (DBG) {
log("startNetStatPoll");
}
resetPollStats();
mNetStatPollEnabled = true;
mPollNetStat.run();
}
if (mPhone != null) {
mPhone.notifyDataActivity();
}
|
protected void | startProvisioningApnAlarm()
int delayInMs = Settings.Global.getInt(mResolver,
Settings.Global.PROVISIONING_APN_ALARM_DELAY_IN_MS,
PROVISIONING_APN_ALARM_DELAY_IN_MS_DEFAULT);
if (Build.IS_DEBUGGABLE) {
// Allow debug code to use a system property to provide another value
String delayInMsStrg = Integer.toString(delayInMs);
delayInMsStrg = System.getProperty(DEBUG_PROV_APN_ALARM, delayInMsStrg);
try {
delayInMs = Integer.parseInt(delayInMsStrg);
} catch (NumberFormatException e) {
loge("startProvisioningApnAlarm: e=" + e);
}
}
mProvisioningApnAlarmTag += 1;
if (DBG) {
log("startProvisioningApnAlarm: tag=" + mProvisioningApnAlarmTag +
" delay=" + (delayInMs / 1000) + "s");
}
Intent intent = new Intent(INTENT_PROVISIONING_APN_ALARM);
intent.putExtra(PROVISIONING_APN_ALARM_TAG_EXTRA, mProvisioningApnAlarmTag);
mProvisioningApnAlarmIntent = PendingIntent.getBroadcast(mPhone.getContext(), 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + delayInMs, mProvisioningApnAlarmIntent);
|
protected void | stopDataStallAlarm()
if (VDBG_STALL) {
log("stopDataStallAlarm: current tag=" + mDataStallAlarmTag +
" mDataStallAlarmIntent=" + mDataStallAlarmIntent);
}
mDataStallAlarmTag += 1;
if (mDataStallAlarmIntent != null) {
mAlarmManager.cancel(mDataStallAlarmIntent);
mDataStallAlarmIntent = null;
}
|
void | stopNetStatPoll()
mNetStatPollEnabled = false;
removeCallbacks(mPollNetStat);
if (DBG) {
log("stopNetStatPoll");
}
// To sync data activity icon in the case of switching data connection to send MMS.
if (mPhone != null) {
mPhone.notifyDataActivity();
}
|
protected void | stopProvisioningApnAlarm()
if (DBG) {
log("stopProvisioningApnAlarm: current tag=" + mProvisioningApnAlarmTag +
" mProvsioningApnAlarmIntent=" + mProvisioningApnAlarmIntent);
}
mProvisioningApnAlarmTag += 1;
if (mProvisioningApnAlarmIntent != null) {
mAlarmManager.cancel(mProvisioningApnAlarmIntent);
mProvisioningApnAlarmIntent = null;
}
|
public void | updateDataActivity()
long sent, received;
DctConstants.Activity newActivity;
TxRxSum preTxRxSum = new TxRxSum(mTxPkts, mRxPkts);
TxRxSum curTxRxSum = new TxRxSum();
curTxRxSum.updateTxRxSum();
mTxPkts = curTxRxSum.txPkts;
mRxPkts = curTxRxSum.rxPkts;
if (VDBG) {
log("updateDataActivity: curTxRxSum=" + curTxRxSum + " preTxRxSum=" + preTxRxSum);
}
if (mNetStatPollEnabled && (preTxRxSum.txPkts > 0 || preTxRxSum.rxPkts > 0)) {
sent = mTxPkts - preTxRxSum.txPkts;
received = mRxPkts - preTxRxSum.rxPkts;
if (VDBG)
log("updateDataActivity: sent=" + sent + " received=" + received);
if (sent > 0 && received > 0) {
newActivity = DctConstants.Activity.DATAINANDOUT;
} else if (sent > 0 && received == 0) {
newActivity = DctConstants.Activity.DATAOUT;
} else if (sent == 0 && received > 0) {
newActivity = DctConstants.Activity.DATAIN;
} else {
newActivity = (mActivity == DctConstants.Activity.DORMANT) ?
mActivity : DctConstants.Activity.NONE;
}
if (mActivity != newActivity && mIsScreenOn) {
if (VDBG)
log("updateDataActivity: newActivity=" + newActivity);
mActivity = newActivity;
mPhone.notifyDataActivity();
}
}
|
private void | updateDataStallInfo()
long sent, received;
TxRxSum preTxRxSum = new TxRxSum(mDataStallTxRxSum);
mDataStallTxRxSum.updateTxRxSum();
if (VDBG_STALL) {
log("updateDataStallInfo: mDataStallTxRxSum=" + mDataStallTxRxSum +
" preTxRxSum=" + preTxRxSum);
}
sent = mDataStallTxRxSum.txPkts - preTxRxSum.txPkts;
received = mDataStallTxRxSum.rxPkts - preTxRxSum.rxPkts;
if (RADIO_TESTS) {
if (SystemProperties.getBoolean("radio.test.data.stall", false)) {
log("updateDataStallInfo: radio.test.data.stall true received = 0;");
received = 0;
}
}
if ( sent > 0 && received > 0 ) {
if (VDBG_STALL) log("updateDataStallInfo: IN/OUT");
mSentSinceLastRecv = 0;
putRecoveryAction(RecoveryAction.GET_DATA_CALL_LIST);
} else if (sent > 0 && received == 0) {
if (mPhone.getState() == PhoneConstants.State.IDLE) {
mSentSinceLastRecv += sent;
} else {
mSentSinceLastRecv = 0;
}
if (DBG) {
log("updateDataStallInfo: OUT sent=" + sent +
" mSentSinceLastRecv=" + mSentSinceLastRecv);
}
} else if (sent == 0 && received > 0) {
if (VDBG_STALL) log("updateDataStallInfo: IN");
mSentSinceLastRecv = 0;
putRecoveryAction(RecoveryAction.GET_DATA_CALL_LIST);
} else {
if (VDBG_STALL) log("updateDataStallInfo: NONE");
}
|