use of com.android.internal.telephony.ApnContext in project XobotOS by xamarin.
the class GsmDataConnectionTracker method getOverallState.
// Return state of overall
public State getOverallState() {
boolean isConnecting = false;
// All enabled Apns should be FAILED.
boolean isFailed = true;
boolean isAnyEnabled = false;
for (ApnContext apnContext : mApnContexts.values()) {
if (apnContext.isEnabled()) {
isAnyEnabled = true;
switch(apnContext.getState()) {
case CONNECTED:
case DISCONNECTING:
if (DBG)
log("overall state is CONNECTED");
return State.CONNECTED;
case CONNECTING:
case INITING:
isConnecting = true;
isFailed = false;
break;
case IDLE:
case SCANNING:
isFailed = false;
break;
}
}
}
if (!isAnyEnabled) {
// Nothing enabled. return IDLE.
if (DBG)
log("overall state is IDLE");
return State.IDLE;
}
if (isConnecting) {
if (DBG)
log("overall state is CONNECTING");
return State.CONNECTING;
} else if (!isFailed) {
if (DBG)
log("overall state is IDLE");
return State.IDLE;
} else {
if (DBG)
log("overall state is FAILED");
return State.FAILED;
}
}
use of com.android.internal.telephony.ApnContext in project XobotOS by xamarin.
the class GsmDataConnectionTracker method onApnChanged.
/**
* Handles changes to the APN database.
*/
private void onApnChanged() {
// TODO: How to handle when multiple APNs are active?
ApnContext defaultApnContext = mApnContexts.get(Phone.APN_TYPE_DEFAULT);
boolean defaultApnIsDisconnected = defaultApnContext.isDisconnected();
if (mPhone instanceof GSMPhone) {
// The "current" may no longer be valid. MMS depends on this to send properly. TBD
((GSMPhone) mPhone).updateCurrentCarrierInProvider();
}
// match the current operator.
if (DBG)
log("onApnChanged: createAllApnList and cleanUpAllConnections");
createAllApnList();
cleanUpAllConnections(!defaultApnIsDisconnected, Phone.REASON_APN_CHANGED);
if (defaultApnIsDisconnected) {
setupDataOnReadyApns(Phone.REASON_APN_CHANGED);
}
}
Aggregations