Merge change 21100 into donut
* changes: Use dataRoaming in dataConnectionTracker.
This commit is contained in:
@@ -412,7 +412,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 = phone.getServiceState().getRoaming();
|
boolean roaming = getDataRoaming();
|
||||||
|
|
||||||
if (mGsmPhone.mSIMRecords.getRecordsLoaded() &&
|
if (mGsmPhone.mSIMRecords.getRecordsLoaded() &&
|
||||||
mGsmPhone.mSST.getCurrentGprsState() == ServiceState.STATE_IN_SERVICE &&
|
mGsmPhone.mSST.getCurrentGprsState() == ServiceState.STATE_IN_SERVICE &&
|
||||||
@@ -424,6 +424,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean getDataRoaming() {
|
||||||
|
return mGsmPhone.mSST.getDataRoaming();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isApnTypeActive(String type) {
|
private boolean isApnTypeActive(String type) {
|
||||||
// TODO: to support simultaneous, mActiveApn can be a List instead.
|
// TODO: to support simultaneous, mActiveApn can be a List instead.
|
||||||
return mActiveApn != null && mActiveApn.canHandleType(type);
|
return mActiveApn != null && mActiveApn.canHandleType(type);
|
||||||
@@ -533,7 +537,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDataAllowed() {
|
private boolean isDataAllowed() {
|
||||||
boolean roaming = phone.getServiceState().getRoaming();
|
boolean roaming = getDataRoaming();
|
||||||
return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
|
return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,7 +584,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int gprsState = mGsmPhone.mSST.getCurrentGprsState();
|
int gprsState = mGsmPhone.mSST.getCurrentGprsState();
|
||||||
boolean roaming = phone.getServiceState().getRoaming();
|
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)
|
||||||
@@ -1245,16 +1249,38 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
protected void onRoamingOff() {
|
protected void onRoamingOff() {
|
||||||
trySetupData(Phone.REASON_ROAMING_OFF);
|
if (!getDataRoaming()) { //data roaming is 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
|
||||||
protected void onRoamingOn() {
|
protected void onRoamingOn() {
|
||||||
if (getDataOnRoamingEnabled()) {
|
if (getDataRoaming()) { // data roaming is on
|
||||||
trySetupData(Phone.REASON_ROAMING_ON);
|
if (getDataOnRoamingEnabled()) {
|
||||||
} else {
|
trySetupData(Phone.REASON_ROAMING_ON);
|
||||||
if (DBG) log("Tear down data connection on roaming.");
|
} else {
|
||||||
cleanUpConnection(true, Phone.REASON_ROAMING_ON);
|
if (DBG) log("Tear down data connection on roaming.");
|
||||||
|
cleanUpConnection(true, Phone.REASON_ROAMING_ON);
|
||||||
|
}
|
||||||
|
} else { // Inconsistent! data roaming is off
|
||||||
|
sendMessage(obtainMessage(EVENT_ROAMING_OFF));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
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 */
|
||||||
private boolean mGsmRoaming = false;
|
private boolean mGsmRoaming = false;
|
||||||
|
/* data roaming status solely based on TS 27.007 10.1.19 CGREG */
|
||||||
|
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();
|
||||||
@@ -309,6 +312,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
psRestrictDisabledRegistrants.remove(h);
|
psRestrictDisabledRegistrants.remove(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*protected*/ boolean getDataRoaming() {
|
||||||
|
return mDataRoaming;
|
||||||
|
}
|
||||||
|
|
||||||
//***** Called from GSMPhone
|
//***** Called from GSMPhone
|
||||||
public void
|
public void
|
||||||
getLacAndCid(Message onComplete) {
|
getLacAndCid(Message onComplete) {
|
||||||
@@ -666,6 +673,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
newGPRSState = regCodeToServiceState(regState);
|
newGPRSState = regCodeToServiceState(regState);
|
||||||
|
newDataRoaming = regCodeIsRoaming(regState);
|
||||||
newNetworkType = type;
|
newNetworkType = type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -693,6 +701,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
|
|
||||||
if (pollingContext[0] == 0) {
|
if (pollingContext[0] == 0) {
|
||||||
newSS.setRoaming(isRoamingBetweenOperators(mGsmRoaming, newSS));
|
newSS.setRoaming(isRoamingBetweenOperators(mGsmRoaming, newSS));
|
||||||
|
// when both roaming indicators are true but not roaming between
|
||||||
|
// operators, roaming should set to false.
|
||||||
|
if (newDataRoaming && mGsmRoaming && !newSS.getRoaming()) {
|
||||||
|
newDataRoaming = false;
|
||||||
|
}
|
||||||
pollStateDone();
|
pollStateDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,6 +735,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
newCellLoc.setStateInvalid();
|
newCellLoc.setStateInvalid();
|
||||||
setSignalStrengthDefaultValues();
|
setSignalStrengthDefaultValues();
|
||||||
mGotCountryCode = false;
|
mGotCountryCode = false;
|
||||||
|
newDataRoaming = false;
|
||||||
|
|
||||||
pollStateDone();
|
pollStateDone();
|
||||||
break;
|
break;
|
||||||
@@ -731,6 +745,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
newCellLoc.setStateInvalid();
|
newCellLoc.setStateInvalid();
|
||||||
setSignalStrengthDefaultValues();
|
setSignalStrengthDefaultValues();
|
||||||
mGotCountryCode = false;
|
mGotCountryCode = false;
|
||||||
|
newDataRoaming = false;
|
||||||
|
|
||||||
pollStateDone();
|
pollStateDone();
|
||||||
break;
|
break;
|
||||||
@@ -745,6 +760,8 @@ 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;
|
||||||
@@ -829,9 +846,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
|
|
||||||
boolean hasChanged = !newSS.equals(ss);
|
boolean hasChanged = !newSS.equals(ss);
|
||||||
|
|
||||||
boolean hasRoamingOn = !ss.getRoaming() && newSS.getRoaming();
|
boolean hasRoamingOn = !mDataRoaming && newDataRoaming;
|
||||||
|
|
||||||
boolean hasRoamingOff = ss.getRoaming() && !newSS.getRoaming();
|
boolean hasRoamingOff = mDataRoaming && !newDataRoaming;
|
||||||
|
|
||||||
boolean hasLocationChanged = !newCellLoc.equals(cellLoc);
|
boolean hasLocationChanged = !newCellLoc.equals(cellLoc);
|
||||||
|
|
||||||
@@ -848,6 +865,7 @@ 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