am 495056ab: Merge "Turn off DUN connection after tethering." into honeycomb

* commit '495056ab6709bbf77879a4b556aa1d17446bfe48':
  Turn off DUN connection after tethering.
This commit is contained in:
Robert Greenwalt
2011-01-13 10:19:39 -08:00
committed by Android Git Automerger
5 changed files with 13 additions and 7 deletions

View File

@@ -849,7 +849,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
usedNetworkType = ConnectivityManager.TYPE_MOBILE_MMS;
} else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_SUPL)) {
usedNetworkType = ConnectivityManager.TYPE_MOBILE_SUPL;
} else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_DUN)) {
} else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_DUN) ||
TextUtils.equals(feature, Phone.FEATURE_ENABLE_DUN_ALWAYS)) {
usedNetworkType = ConnectivityManager.TYPE_MOBILE_DUN;
} else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_HIPRI)) {
usedNetworkType = ConnectivityManager.TYPE_MOBILE_HIPRI;
@@ -870,6 +871,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return 1;
}
callTeardown = true;
} else {
if (DBG) log("not a known feature - dropping");
}
}
if (DBG) log("Doing network teardown");

View File

@@ -1165,7 +1165,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
IConnectivityManager.Stub.asInterface(b);
try {
service.stopUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
(mDunRequired? Phone.FEATURE_ENABLE_DUN :
(mDunRequired? Phone.FEATURE_ENABLE_DUN_ALWAYS :
Phone.FEATURE_ENABLE_HIPRI));
} catch (Exception e) {
return false;
@@ -1354,10 +1354,11 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
}
class TetherModeAliveState extends TetherMasterUtilState {
boolean mTryCell = WAIT_FOR_NETWORK_TO_SETTLE;
boolean mTryCell = !WAIT_FOR_NETWORK_TO_SETTLE;
@Override
public void enter() {
mTryCell = WAIT_FOR_NETWORK_TO_SETTLE; // first pass lets just see what we have.
mTryCell = !WAIT_FOR_NETWORK_TO_SETTLE; // better try something first pass
// or crazy tests cases will fail
chooseUpstreamType(mTryCell);
mTryCell = !mTryCell;
turnOnMasterTetherSettings(); // may transition us out

View File

@@ -358,7 +358,7 @@ public abstract class DataConnectionTracker extends Handler {
return new ArrayList<DataConnection>(mDataConnections.values());
}
protected boolean isApnTypeActive(String type) {
public boolean isApnTypeActive(String type) {
// TODO: support simultaneous with List instead
return mActiveApn != null && mActiveApn.canHandleType(type);
}

View File

@@ -610,7 +610,8 @@ public class CDMAPhone extends PhoneBase {
// If we're out of service, open TCP sockets may still work
// but no data will flow
ret = DataState.DISCONNECTED;
} else if (mDataConnection.isApnTypeEnabled(apnType) == false) {
} else if (mDataConnection.isApnTypeEnabled(apnType) == false ||
mDataConnection.isApnTypeActive(apnType) == false) {
ret = DataState.DISCONNECTED;
} else {
switch (mDataConnection.getState()) {

View File

@@ -300,7 +300,8 @@ public class GSMPhone extends PhoneBase {
// If we're out of service, open TCP sockets may still work
// but no data will flow
ret = DataState.DISCONNECTED;
} else if (mDataConnection.isApnTypeEnabled(apnType) == false) {
} else if (mDataConnection.isApnTypeEnabled(apnType) == false ||
mDataConnection.isApnTypeActive(apnType) == false) {
ret = DataState.DISCONNECTED;
} else { /* mSST.gprsState == ServiceState.STATE_IN_SERVICE */
switch (mDataConnection.getState()) {