diff options
Diffstat (limited to 'com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java')
-rw-r--r-- | com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java | 52 |
1 files changed, 6 insertions, 46 deletions
diff --git a/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java b/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java index b35ed751..c5f75280 100644 --- a/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java +++ b/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java @@ -95,10 +95,7 @@ public class UpstreamNetworkMonitor { private NetworkCallback mDefaultNetworkCallback; private NetworkCallback mMobileNetworkCallback; private boolean mDunRequired; - // The current system default network (not really used yet). - private Network mDefaultInternetNetwork; - // The current upstream network used for tethering. - private Network mTetheringUpstreamNetwork; + private Network mCurrentDefault; public UpstreamNetworkMonitor(Context ctx, StateMachine tgt, SharedLog log, int what) { mContext = ctx; @@ -133,12 +130,10 @@ public class UpstreamNetworkMonitor { releaseCallback(mDefaultNetworkCallback); mDefaultNetworkCallback = null; - mDefaultInternetNetwork = null; releaseCallback(mListenAllCallback); mListenAllCallback = null; - mTetheringUpstreamNetwork = null; mNetworkMap.clear(); } @@ -212,7 +207,7 @@ public class UpstreamNetworkMonitor { break; default: /* If we've found an active upstream connection that's not DUN/HIPRI - * we should stop any outstanding DUN/HIPRI requests. + * we should stop any outstanding DUN/HIPRI start requests. * * If we found NONE we don't want to do this as we want any previous * requests to keep trying to bring up something we can use. @@ -224,10 +219,6 @@ public class UpstreamNetworkMonitor { return typeStatePair.ns; } - public void setCurrentUpstream(Network upstream) { - mTetheringUpstreamNetwork = upstream; - } - public Set<IpPrefix> getLocalPrefixes() { return (Set<IpPrefix>) mLocalPrefixes.clone(); } @@ -259,7 +250,7 @@ public class UpstreamNetworkMonitor { // These request*() calls can be deleted post oag/339444. return; } - mDefaultInternetNetwork = network; + mCurrentDefault = network; break; case CALLBACK_MOBILE_REQUEST: @@ -311,13 +302,6 @@ public class UpstreamNetworkMonitor { network, newNc)); } - // Log changes in upstream network signal strength, if available. - if (network.equals(mTetheringUpstreamNetwork) && newNc.hasSignalStrength()) { - final int newSignal = newNc.getSignalStrength(); - final String prevSignal = getSignalStrength(prev.networkCapabilities); - mLog.logf("upstream network signal strength: %s -> %s", prevSignal, newSignal); - } - mNetworkMap.put(network, new NetworkState( null, prev.linkProperties, newNc, network, null, null)); // TODO: If sufficient information is available to select a more @@ -346,21 +330,9 @@ public class UpstreamNetworkMonitor { notifyTarget(EVENT_ON_LINKPROPERTIES, network); } - private void handleSuspended(int callbackType, Network network) { - if (callbackType != CALLBACK_LISTEN_ALL) return; - if (!network.equals(mTetheringUpstreamNetwork)) return; - mLog.log("SUSPENDED current upstream: " + network); - } - - private void handleResumed(int callbackType, Network network) { - if (callbackType != CALLBACK_LISTEN_ALL) return; - if (!network.equals(mTetheringUpstreamNetwork)) return; - mLog.log("RESUMED current upstream: " + network); - } - private void handleLost(int callbackType, Network network) { if (callbackType == CALLBACK_TRACK_DEFAULT) { - mDefaultInternetNetwork = null; + mCurrentDefault = null; // Receiving onLost() for a default network does not necessarily // mean the network is gone. We wait for a separate notification // on either the LISTEN_ALL or MOBILE_REQUEST callbacks before @@ -429,15 +401,8 @@ public class UpstreamNetworkMonitor { recomputeLocalPrefixes(); } - @Override - public void onNetworkSuspended(Network network) { - handleSuspended(mCallbackType, network); - } - - @Override - public void onNetworkResumed(Network network) { - handleResumed(mCallbackType, network); - } + // TODO: Handle onNetworkSuspended(); + // TODO: Handle onNetworkResumed(); @Override public void onLost(Network network) { @@ -502,9 +467,4 @@ public class UpstreamNetworkMonitor { return prefixSet; } - - private static String getSignalStrength(NetworkCapabilities nc) { - if (nc == null || !nc.hasSignalStrength()) return "unknown"; - return Integer.toString(nc.getSignalStrength()); - } } |