diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2011-01-25 10:27:51 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-25 10:27:51 -0800 |
commit | d14239a2fb12d775f7b2345286d36ac02234e0a7 (patch) | |
tree | 2347050bd15ede0f1b6b15f65fd7602691d52e66 | |
parent | c1e7f2d371aa6c2aa9ed3207689cb53a1f704cbc (diff) | |
parent | 05d8936f275762bab0d66c6337e352388c8eeee0 (diff) | |
download | frameworks_base-d14239a2fb12d775f7b2345286d36ac02234e0a7.zip frameworks_base-d14239a2fb12d775f7b2345286d36ac02234e0a7.tar.gz frameworks_base-d14239a2fb12d775f7b2345286d36ac02234e0a7.tar.bz2 |
Merge "Fix tethering when switching default connection" into honeycomb
-rw-r--r-- | services/java/com/android/server/connectivity/Tethering.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java index dd9db9a..26c7e71 100644 --- a/services/java/com/android/server/connectivity/Tethering.java +++ b/services/java/com/android/server/connectivity/Tethering.java @@ -31,6 +31,7 @@ import android.net.ConnectivityManager; import android.net.InterfaceConfiguration; import android.net.IConnectivityManager; import android.net.INetworkManagementEventObserver; +import android.net.LinkProperties; import android.net.NetworkInfo; import android.os.Binder; import android.os.Environment; @@ -1219,7 +1220,20 @@ public class Tethering extends INetworkManagementEventObserver.Stub { } protected String findActiveUpstreamIface() { // check for what iface we can use - if none found switch to error. - IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); + IBinder b = ServiceManager.getService(Context.CONNECTIVITY_SERVICE); + IConnectivityManager cm = IConnectivityManager.Stub.asInterface(b); + + try { + LinkProperties defaultProp = cm.getActiveLinkProperties(); + if (defaultProp != null) { + String iface = defaultProp.getInterfaceName(); + for(String regex : mUpstreamIfaceRegexs) { + if (iface.matches(regex)) return iface; + } + } + } catch (RemoteException e) { } + + b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); INetworkManagementService service = INetworkManagementService.Stub.asInterface(b); String[] ifaces = new String[0]; @@ -1390,7 +1404,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub { } break; case CMD_UPSTREAM_CHANGED: - mTryCell = WAIT_FOR_NETWORK_TO_SETTLE; + // need to try DUN immediately if Wifi goes down + mTryCell = !WAIT_FOR_NETWORK_TO_SETTLE; chooseUpstreamType(mTryCell); mTryCell = !mTryCell; break; |