am ac5bd144: Merge change Ib23e57cf into eclair
Merge commit 'ac5bd144f1add259d53f2e09dc0cef38f1f5bd3f' into eclair-plus-aosp * commit 'ac5bd144f1add259d53f2e09dc0cef38f1f5bd3f': Set roaming based on both data and voice.
This commit is contained in:
@@ -351,7 +351,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
* @return false while no data connection if all above requirements are met.
|
* @return false while no data connection if all above requirements are met.
|
||||||
*/
|
*/
|
||||||
public boolean isDataConnectionAsDesired() {
|
public boolean isDataConnectionAsDesired() {
|
||||||
boolean roaming = getDataRoaming();
|
boolean roaming = phone.getServiceState().getRoaming();
|
||||||
|
|
||||||
if (mGsmPhone.mSIMRecords.getRecordsLoaded() &&
|
if (mGsmPhone.mSIMRecords.getRecordsLoaded() &&
|
||||||
mGsmPhone.mSST.getCurrentGprsState() == ServiceState.STATE_IN_SERVICE &&
|
mGsmPhone.mSST.getCurrentGprsState() == ServiceState.STATE_IN_SERVICE &&
|
||||||
@@ -363,10 +363,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getDataRoaming() {
|
|
||||||
return mGsmPhone.mSST.getDataRoaming();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isApnTypeActive(String type) {
|
protected boolean isApnTypeActive(String type) {
|
||||||
// TODO: support simultaneous with List instead
|
// TODO: support simultaneous with List instead
|
||||||
@@ -394,7 +390,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDataAllowed() {
|
private boolean isDataAllowed() {
|
||||||
boolean roaming = getDataRoaming();
|
boolean roaming = phone.getServiceState().getRoaming();
|
||||||
return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
|
return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +437,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int gprsState = mGsmPhone.mSST.getCurrentGprsState();
|
int gprsState = mGsmPhone.mSST.getCurrentGprsState();
|
||||||
boolean roaming = getDataRoaming();
|
|
||||||
boolean desiredPowerState = mGsmPhone.mSST.getDesiredPowerState();
|
boolean desiredPowerState = mGsmPhone.mSST.getDesiredPowerState();
|
||||||
|
|
||||||
if ((state == State.IDLE || state == State.SCANNING)
|
if ((state == State.IDLE || state == State.SCANNING)
|
||||||
@@ -477,7 +472,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
" phoneState=" + phone.getState() +
|
" phoneState=" + phone.getState() +
|
||||||
" isDataAllowed=" + isDataAllowed() +
|
" isDataAllowed=" + isDataAllowed() +
|
||||||
" dataEnabled=" + getAnyDataEnabled() +
|
" dataEnabled=" + getAnyDataEnabled() +
|
||||||
" roaming=" + roaming +
|
" roaming=" + phone.getServiceState().getRoaming() +
|
||||||
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
|
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
|
||||||
" ps restricted=" + mIsPsRestricted +
|
" ps restricted=" + mIsPsRestricted +
|
||||||
" desiredPowerState=" + desiredPowerState);
|
" desiredPowerState=" + desiredPowerState);
|
||||||
@@ -1112,38 +1107,18 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return trySetupData(reason);
|
return trySetupData(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check the data roaming consistency since this can be triggered by
|
|
||||||
* voice roaming flag of ServiceState in setDataOnRoamingEnabled()
|
|
||||||
*
|
|
||||||
* TODO make this triggered by data roaming state only
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRoamingOff() {
|
protected void onRoamingOff() {
|
||||||
if (!getDataRoaming()) { //data roaming is off
|
trySetupData(Phone.REASON_ROAMING_OFF);
|
||||||
trySetupData(Phone.REASON_ROAMING_OFF);
|
|
||||||
} else { // Inconsistent! data roaming is on
|
|
||||||
sendMessage(obtainMessage(EVENT_ROAMING_ON));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check the data roaming consistency since this can be triggered by
|
|
||||||
* voice roaming flag of ServiceState in setDataOnRoamingEnabled()
|
|
||||||
*
|
|
||||||
* TODO make this triggered by data roaming state only
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRoamingOn() {
|
protected void onRoamingOn() {
|
||||||
if (getDataRoaming()) { // data roaming is on
|
if (getDataOnRoamingEnabled()) {
|
||||||
if (getDataOnRoamingEnabled()) {
|
trySetupData(Phone.REASON_ROAMING_ON);
|
||||||
trySetupData(Phone.REASON_ROAMING_ON);
|
} else {
|
||||||
} else {
|
if (DBG) log("Tear down data connection on roaming.");
|
||||||
if (DBG) log("Tear down data connection on roaming.");
|
cleanUpConnection(true, Phone.REASON_ROAMING_ON);
|
||||||
cleanUpConnection(true, Phone.REASON_ROAMING_ON);
|
|
||||||
}
|
|
||||||
} else { // Inconsistent! data roaming is off
|
|
||||||
sendMessage(obtainMessage(EVENT_ROAMING_OFF));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,12 +83,17 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
private int networkType = 0;
|
private int networkType = 0;
|
||||||
private int newNetworkType = 0;
|
private int newNetworkType = 0;
|
||||||
|
|
||||||
/** GSM roaming status solely based on TS 27.007 7.2 CREG. */
|
/**
|
||||||
|
* GSM roaming status solely based on TS 27.007 7.2 CREG. Only used by
|
||||||
|
* handlePollStateResult to store CREG roaming result.
|
||||||
|
*/
|
||||||
private boolean mGsmRoaming = false;
|
private boolean mGsmRoaming = false;
|
||||||
|
|
||||||
/** Data roaming status solely based on TS 27.007 10.1.19 CGREG. */
|
/**
|
||||||
|
* Data roaming status solely based on TS 27.007 10.1.19 CGREG. Only used by
|
||||||
|
* handlePollStateResult to store CGREG roaming result.
|
||||||
|
*/
|
||||||
private boolean mDataRoaming = false;
|
private boolean mDataRoaming = false;
|
||||||
private boolean newDataRoaming = false;
|
|
||||||
|
|
||||||
private RegistrantList gprsAttachedRegistrants = new RegistrantList();
|
private RegistrantList gprsAttachedRegistrants = new RegistrantList();
|
||||||
private RegistrantList gprsDetachedRegistrants = new RegistrantList();
|
private RegistrantList gprsDetachedRegistrants = new RegistrantList();
|
||||||
@@ -310,10 +315,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
psRestrictDisabledRegistrants.remove(h);
|
psRestrictDisabledRegistrants.remove(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean getDataRoaming() {
|
|
||||||
return mDataRoaming;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handleMessage (Message msg) {
|
public void handleMessage (Message msg) {
|
||||||
AsyncResult ar;
|
AsyncResult ar;
|
||||||
int[] ints;
|
int[] ints;
|
||||||
@@ -627,7 +628,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
|
|
||||||
mGsmRoaming = regCodeIsRoaming(regState);
|
mGsmRoaming = regCodeIsRoaming(regState);
|
||||||
newSS.setState (regCodeToServiceState(regState));
|
newSS.setState (regCodeToServiceState(regState));
|
||||||
|
|
||||||
// LAC and CID are -1 if not avail
|
// LAC and CID are -1 if not avail
|
||||||
newCellLoc.setLacAndCid(lac, cid);
|
newCellLoc.setLacAndCid(lac, cid);
|
||||||
break;
|
break;
|
||||||
@@ -650,7 +650,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
newGPRSState = regCodeToServiceState(regState);
|
newGPRSState = regCodeToServiceState(regState);
|
||||||
newDataRoaming = regCodeIsRoaming(regState);
|
mDataRoaming = regCodeIsRoaming(regState);
|
||||||
newNetworkType = type;
|
newNetworkType = type;
|
||||||
newSS.setRadioTechnology(type);
|
newSS.setRadioTechnology(type);
|
||||||
break;
|
break;
|
||||||
@@ -678,15 +678,22 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
pollingContext[0]--;
|
pollingContext[0]--;
|
||||||
|
|
||||||
if (pollingContext[0] == 0) {
|
if (pollingContext[0] == 0) {
|
||||||
newSS.setRoaming(isRoamingBetweenOperators(mGsmRoaming, newSS));
|
/**
|
||||||
// when both roaming indicators are true but not roaming between
|
* Since the roaming states of gsm service (from +CREG) and
|
||||||
// operators, roaming should set to false.
|
* data service (from +CGREG) could be different, the new SS
|
||||||
if (newDataRoaming && mGsmRoaming && !newSS.getRoaming()) {
|
* is set roaming while either one is roaming.
|
||||||
newDataRoaming = false;
|
*
|
||||||
|
* There is an exception for the above rule. The new SS is not set
|
||||||
|
* as roaming while gsm service reports roaming but indeed it is
|
||||||
|
* not roaming between operators.
|
||||||
|
*/
|
||||||
|
boolean roaming = (mGsmRoaming || mDataRoaming);
|
||||||
|
if (mGsmRoaming && !isRoamingBetweenOperators(mGsmRoaming, newSS)) {
|
||||||
|
roaming = false;
|
||||||
}
|
}
|
||||||
|
newSS.setRoaming(roaming);
|
||||||
pollStateDone();
|
pollStateDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSignalStrengthDefaultValues() {
|
private void setSignalStrengthDefaultValues() {
|
||||||
@@ -711,8 +718,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
newCellLoc.setStateInvalid();
|
newCellLoc.setStateInvalid();
|
||||||
setSignalStrengthDefaultValues();
|
setSignalStrengthDefaultValues();
|
||||||
mGotCountryCode = false;
|
mGotCountryCode = false;
|
||||||
newDataRoaming = false;
|
|
||||||
|
|
||||||
pollStateDone();
|
pollStateDone();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -721,8 +726,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
newCellLoc.setStateInvalid();
|
newCellLoc.setStateInvalid();
|
||||||
setSignalStrengthDefaultValues();
|
setSignalStrengthDefaultValues();
|
||||||
mGotCountryCode = false;
|
mGotCountryCode = false;
|
||||||
newDataRoaming = false;
|
|
||||||
|
|
||||||
pollStateDone();
|
pollStateDone();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -736,8 +739,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
newCellLoc.setStateInvalid();
|
newCellLoc.setStateInvalid();
|
||||||
setSignalStrengthDefaultValues();
|
setSignalStrengthDefaultValues();
|
||||||
mGotCountryCode = false;
|
mGotCountryCode = false;
|
||||||
newDataRoaming = false;
|
|
||||||
mDataRoaming = false;
|
|
||||||
|
|
||||||
//NOTE: pollStateDone() is not needed in this case
|
//NOTE: pollStateDone() is not needed in this case
|
||||||
break;
|
break;
|
||||||
@@ -830,9 +831,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
|
|
||||||
boolean hasChanged = !newSS.equals(ss);
|
boolean hasChanged = !newSS.equals(ss);
|
||||||
|
|
||||||
boolean hasRoamingOn = !mDataRoaming && newDataRoaming;
|
boolean hasRoamingOn = !ss.getRoaming() && newSS.getRoaming();
|
||||||
|
|
||||||
boolean hasRoamingOff = mDataRoaming && !newDataRoaming;
|
boolean hasRoamingOff = ss.getRoaming() && !newSS.getRoaming();
|
||||||
|
|
||||||
boolean hasLocationChanged = !newCellLoc.equals(cellLoc);
|
boolean hasLocationChanged = !newCellLoc.equals(cellLoc);
|
||||||
|
|
||||||
@@ -849,7 +850,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
|
|
||||||
gprsState = newGPRSState;
|
gprsState = newGPRSState;
|
||||||
networkType = newNetworkType;
|
networkType = newNetworkType;
|
||||||
mDataRoaming = newDataRoaming;
|
|
||||||
|
|
||||||
newSS.setStateOutOfService(); // clean slate for next time
|
newSS.setStateOutOfService(); // clean slate for next time
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user