Merge change Ie944f08b into eclair
* changes:
Revert setDataEnabled to setting a master switch.
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 1f0e5a5..52c8b1f 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -100,6 +100,7 @@
public static final int EVENT_CLEAN_UP_CONNECTION = 34;
protected static final int EVENT_CDMA_OTA_PROVISION = 35;
protected static final int EVENT_RESTART_RADIO = 36;
+ protected static final int EVENT_SET_MASTER_DATA_ENABLE = 37;
/***** Constants *****/
@@ -111,8 +112,11 @@
protected static final int APN_HIPRI_ID = 4;
protected static final int APN_NUM_TYPES = 5;
- protected static final int APN_DISABLED = 0;
- protected static final int APN_ENABLED = 1;
+ protected static final int DISABLED = 0;
+ protected static final int ENABLED = 1;
+
+ // responds to the setDataEnabled call - used independently from the APN requests
+ protected boolean mMasterDataEnabled = true;
protected boolean[] dataEnabled = new boolean[APN_NUM_TYPES];
protected int enabledCount = 0;
@@ -322,6 +326,11 @@
onCleanUpConnection(tearDown, (String)msg.obj);
break;
+ case EVENT_SET_MASTER_DATA_ENABLE:
+ boolean enabled = (msg.arg1 == ENABLED) ? true : false;
+ onSetDataEnabled(enabled);
+ break;
+
default:
Log.e("DATA", "Unidentified event = " + msg.what);
break;
@@ -486,7 +495,7 @@
Message msg = obtainMessage(EVENT_ENABLE_NEW_APN);
msg.arg1 = id;
- msg.arg2 = (enable ? APN_ENABLED : APN_DISABLED);
+ msg.arg2 = (enable ? ENABLED : DISABLED);
sendMessage(msg);
}
@@ -497,7 +506,7 @@
", enabledCount = " + enabledCount +
", isApnTypeActive = " + isApnTypeActive(apnIdToType(apnId)));
}
- if (enabled == APN_ENABLED) {
+ if (enabled == ENABLED) {
if (!dataEnabled[apnId]) {
dataEnabled[apnId] = true;
enabledCount++;
@@ -545,8 +554,24 @@
*/
public boolean setDataEnabled(boolean enable) {
if (DBG) Log.d(LOG_TAG, "setDataEnabled(" + enable + ")");
- setEnabled(APN_DEFAULT_ID, enable);
+
+ Message msg = obtainMessage(EVENT_SET_MASTER_DATA_ENABLE);
+ msg.arg1 = (enable ? ENABLED : DISABLED);
+ sendMessage(msg);
return true;
}
+ protected void onSetDataEnabled(boolean enable) {
+ if (mMasterDataEnabled != enable) {
+ mMasterDataEnabled = enable;
+ if (enable) {
+ mRetryMgr.resetRetryCount();
+ onTrySetupData(Phone.REASON_DATA_ENABLED);
+ } else {
+ onCleanUpConnection(true, Phone.REASON_DATA_DISABLED);
+ }
+ }
+ }
+
+
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
index 9fe2038..1005d20 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
@@ -1039,8 +1039,8 @@
private void disableDataCallInEmergencyCall(String dialString) {
if (PhoneNumberUtils.isEmergencyNumber(dialString)) {
if (Phone.DEBUG_PHONE) log("disableDataCallInEmergencyCall");
- phone.disableDataConnectivity();
mIsInEmergencyCall = true;
+ phone.disableDataConnectivity();
}
}
@@ -1050,15 +1050,16 @@
*/
private void checkAndEnableDataCallAfterEmergencyCallDropped() {
if (mIsInEmergencyCall) {
+ mIsInEmergencyCall = false;
String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
if (Phone.DEBUG_PHONE) {
log("checkAndEnableDataCallAfterEmergencyCallDropped,inEcm=" + inEcm);
}
if (inEcm.compareTo("false") == 0) {
// Re-initiate data connection
+ // TODO - can this be changed to phone.enableDataConnectivity();
phone.mDataConnection.setDataEnabled(true);
}
- mIsInEmergencyCall = false;
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index d0a9337..c695dd7 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -302,7 +302,7 @@
private boolean isDataAllowed() {
boolean roaming = phone.getServiceState().getRoaming();
- return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
+ return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled()) && mMasterDataEnabled;
}
private boolean trySetupData(String reason) {
@@ -347,7 +347,8 @@
" roaming=" + roaming +
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
" desiredPowerState=" + desiredPowerState +
- " PendingRestartRadio=" + mPendingRestartRadio);
+ " PendingRestartRadio=" + mPendingRestartRadio +
+ " MasterDataEnabled=" + mMasterDataEnabled);
}
return false;
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index 5bdf09f..ffd6dd3 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -391,7 +391,8 @@
private boolean isDataAllowed() {
boolean roaming = phone.getServiceState().getRoaming();
- return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
+ return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled()) &&
+ mMasterDataEnabled;
}
//****** Called from ServiceStateTracker
@@ -475,7 +476,8 @@
" roaming=" + phone.getServiceState().getRoaming() +
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
" ps restricted=" + mIsPsRestricted +
- " desiredPowerState=" + desiredPowerState);
+ " desiredPowerState=" + desiredPowerState +
+ " MasterDataEnabled=" + mMasterDataEnabled);
return false;
}
}
@@ -1039,7 +1041,7 @@
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
// if no more retries on a secondary APN attempt, tell the world and revert.
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
- onEnableApn(apnTypeToId(mRequestedApnType), APN_DISABLED);
+ onEnableApn(apnTypeToId(mRequestedApnType), DISABLED);
return;
}
if (mReregisterOnReconnectFailure) {
@@ -1203,7 +1205,7 @@
notifyNoData(cause);
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
- onEnableApn(apnTypeToId(mRequestedApnType), APN_DISABLED);
+ onEnableApn(apnTypeToId(mRequestedApnType), DISABLED);
}
return;
}