Merge "Fix findConnectionTypeForIface." into lmp-dev

This commit is contained in:
Lorenzo Colitti
2014-08-21 16:08:11 +00:00
committed by Android (Google) Code Review

View File

@@ -2850,11 +2850,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
enforceConnectivityInternalPermission();
if (TextUtils.isEmpty(iface)) return ConnectivityManager.TYPE_NONE;
for (NetworkStateTracker tracker : mNetTrackers) {
if (tracker != null) {
LinkProperties lp = tracker.getLinkProperties();
if (lp != null && iface.equals(lp.getInterfaceName())) {
return tracker.getNetworkInfo().getType();
synchronized(mNetworkForNetId) {
for (int i = 0; i < mNetworkForNetId.size(); i++) {
NetworkAgentInfo nai = mNetworkForNetId.valueAt(i);
LinkProperties lp = nai.linkProperties;
if (lp != null && iface.equals(lp.getInterfaceName()) && nai.networkInfo != null) {
return nai.networkInfo.getType();
}
}
}