am 15a5bffb: Merge change Ie944f08b into eclair
Merge commit '15a5bffb7efc59895a92e6072717e001d2d9480c' into eclair-plus-aosp * commit '15a5bffb7efc59895a92e6072717e001d2d9480c': Revert setDataEnabled to setting a master switch.
This commit is contained in:
@@ -100,6 +100,7 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
public static final int EVENT_CLEAN_UP_CONNECTION = 34;
|
public static final int EVENT_CLEAN_UP_CONNECTION = 34;
|
||||||
protected static final int EVENT_CDMA_OTA_PROVISION = 35;
|
protected static final int EVENT_CDMA_OTA_PROVISION = 35;
|
||||||
protected static final int EVENT_RESTART_RADIO = 36;
|
protected static final int EVENT_RESTART_RADIO = 36;
|
||||||
|
protected static final int EVENT_SET_MASTER_DATA_ENABLE = 37;
|
||||||
|
|
||||||
/***** Constants *****/
|
/***** Constants *****/
|
||||||
|
|
||||||
@@ -111,8 +112,11 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
protected static final int APN_HIPRI_ID = 4;
|
protected static final int APN_HIPRI_ID = 4;
|
||||||
protected static final int APN_NUM_TYPES = 5;
|
protected static final int APN_NUM_TYPES = 5;
|
||||||
|
|
||||||
protected static final int APN_DISABLED = 0;
|
protected static final int DISABLED = 0;
|
||||||
protected static final int APN_ENABLED = 1;
|
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 boolean[] dataEnabled = new boolean[APN_NUM_TYPES];
|
||||||
protected int enabledCount = 0;
|
protected int enabledCount = 0;
|
||||||
@@ -322,6 +326,11 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
onCleanUpConnection(tearDown, (String)msg.obj);
|
onCleanUpConnection(tearDown, (String)msg.obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVENT_SET_MASTER_DATA_ENABLE:
|
||||||
|
boolean enabled = (msg.arg1 == ENABLED) ? true : false;
|
||||||
|
onSetDataEnabled(enabled);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Log.e("DATA", "Unidentified event = " + msg.what);
|
Log.e("DATA", "Unidentified event = " + msg.what);
|
||||||
break;
|
break;
|
||||||
@@ -486,7 +495,7 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
|
|
||||||
Message msg = obtainMessage(EVENT_ENABLE_NEW_APN);
|
Message msg = obtainMessage(EVENT_ENABLE_NEW_APN);
|
||||||
msg.arg1 = id;
|
msg.arg1 = id;
|
||||||
msg.arg2 = (enable ? APN_ENABLED : APN_DISABLED);
|
msg.arg2 = (enable ? ENABLED : DISABLED);
|
||||||
sendMessage(msg);
|
sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +506,7 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
", enabledCount = " + enabledCount +
|
", enabledCount = " + enabledCount +
|
||||||
", isApnTypeActive = " + isApnTypeActive(apnIdToType(apnId)));
|
", isApnTypeActive = " + isApnTypeActive(apnIdToType(apnId)));
|
||||||
}
|
}
|
||||||
if (enabled == APN_ENABLED) {
|
if (enabled == ENABLED) {
|
||||||
if (!dataEnabled[apnId]) {
|
if (!dataEnabled[apnId]) {
|
||||||
dataEnabled[apnId] = true;
|
dataEnabled[apnId] = true;
|
||||||
enabledCount++;
|
enabledCount++;
|
||||||
@@ -545,8 +554,24 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
*/
|
*/
|
||||||
public boolean setDataEnabled(boolean enable) {
|
public boolean setDataEnabled(boolean enable) {
|
||||||
if (DBG) Log.d(LOG_TAG, "setDataEnabled(" + 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;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1039,8 +1039,8 @@ public final class CdmaCallTracker extends CallTracker {
|
|||||||
private void disableDataCallInEmergencyCall(String dialString) {
|
private void disableDataCallInEmergencyCall(String dialString) {
|
||||||
if (PhoneNumberUtils.isEmergencyNumber(dialString)) {
|
if (PhoneNumberUtils.isEmergencyNumber(dialString)) {
|
||||||
if (Phone.DEBUG_PHONE) log("disableDataCallInEmergencyCall");
|
if (Phone.DEBUG_PHONE) log("disableDataCallInEmergencyCall");
|
||||||
phone.disableDataConnectivity();
|
|
||||||
mIsInEmergencyCall = true;
|
mIsInEmergencyCall = true;
|
||||||
|
phone.disableDataConnectivity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,15 +1050,16 @@ public final class CdmaCallTracker extends CallTracker {
|
|||||||
*/
|
*/
|
||||||
private void checkAndEnableDataCallAfterEmergencyCallDropped() {
|
private void checkAndEnableDataCallAfterEmergencyCallDropped() {
|
||||||
if (mIsInEmergencyCall) {
|
if (mIsInEmergencyCall) {
|
||||||
|
mIsInEmergencyCall = false;
|
||||||
String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
|
String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
|
||||||
if (Phone.DEBUG_PHONE) {
|
if (Phone.DEBUG_PHONE) {
|
||||||
log("checkAndEnableDataCallAfterEmergencyCallDropped,inEcm=" + inEcm);
|
log("checkAndEnableDataCallAfterEmergencyCallDropped,inEcm=" + inEcm);
|
||||||
}
|
}
|
||||||
if (inEcm.compareTo("false") == 0) {
|
if (inEcm.compareTo("false") == 0) {
|
||||||
// Re-initiate data connection
|
// Re-initiate data connection
|
||||||
|
// TODO - can this be changed to phone.enableDataConnectivity();
|
||||||
phone.mDataConnection.setDataEnabled(true);
|
phone.mDataConnection.setDataEnabled(true);
|
||||||
}
|
}
|
||||||
mIsInEmergencyCall = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
|
|
||||||
private boolean isDataAllowed() {
|
private boolean isDataAllowed() {
|
||||||
boolean roaming = phone.getServiceState().getRoaming();
|
boolean roaming = phone.getServiceState().getRoaming();
|
||||||
return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
|
return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled()) && mMasterDataEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetupData(String reason) {
|
private boolean trySetupData(String reason) {
|
||||||
@@ -347,7 +347,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
" roaming=" + roaming +
|
" roaming=" + roaming +
|
||||||
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
|
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
|
||||||
" desiredPowerState=" + desiredPowerState +
|
" desiredPowerState=" + desiredPowerState +
|
||||||
" PendingRestartRadio=" + mPendingRestartRadio);
|
" PendingRestartRadio=" + mPendingRestartRadio +
|
||||||
|
" MasterDataEnabled=" + mMasterDataEnabled);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -391,7 +391,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
|
|
||||||
private boolean isDataAllowed() {
|
private boolean isDataAllowed() {
|
||||||
boolean roaming = phone.getServiceState().getRoaming();
|
boolean roaming = phone.getServiceState().getRoaming();
|
||||||
return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
|
return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled()) &&
|
||||||
|
mMasterDataEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
//****** Called from ServiceStateTracker
|
//****** Called from ServiceStateTracker
|
||||||
@@ -475,7 +476,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
" roaming=" + phone.getServiceState().getRoaming() +
|
" roaming=" + phone.getServiceState().getRoaming() +
|
||||||
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
|
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
|
||||||
" ps restricted=" + mIsPsRestricted +
|
" ps restricted=" + mIsPsRestricted +
|
||||||
" desiredPowerState=" + desiredPowerState);
|
" desiredPowerState=" + desiredPowerState +
|
||||||
|
" MasterDataEnabled=" + mMasterDataEnabled);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1039,7 +1041,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
|
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
|
||||||
// if no more retries on a secondary APN attempt, tell the world and revert.
|
// if no more retries on a secondary APN attempt, tell the world and revert.
|
||||||
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
|
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
|
||||||
onEnableApn(apnTypeToId(mRequestedApnType), APN_DISABLED);
|
onEnableApn(apnTypeToId(mRequestedApnType), DISABLED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mReregisterOnReconnectFailure) {
|
if (mReregisterOnReconnectFailure) {
|
||||||
@@ -1203,7 +1205,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
notifyNoData(cause);
|
notifyNoData(cause);
|
||||||
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
|
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
|
||||||
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
|
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
|
||||||
onEnableApn(apnTypeToId(mRequestedApnType), APN_DISABLED);
|
onEnableApn(apnTypeToId(mRequestedApnType), DISABLED);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user