Simplfy getActive* calls in ConnectivityService

One had been simplified on GB, but somehow it didn't make it here.
bug: 4463770

Change-Id: Ica51e836b1a7a489526a223168910b8e06c99c2b
This commit is contained in:
Robert Greenwalt
2011-05-20 12:23:41 -07:00
parent 049694bfa2
commit e1544bb9ea

View File

@@ -540,21 +540,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
* active * active
*/ */
public NetworkInfo getActiveNetworkInfo() { public NetworkInfo getActiveNetworkInfo() {
enforceAccessPermission(); return getNetworkInfo(mActiveDefaultNetwork);
for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
if (mNetConfigs[type] == null || !mNetConfigs[type].isDefault()) {
continue;
}
NetworkStateTracker t = mNetTrackers[type];
NetworkInfo info = t.getNetworkInfo();
if (info.isConnected()) {
if (DBG && type != mActiveDefaultNetwork) {
loge("connected default network is not mActiveDefaultNetwork!");
}
return info;
}
}
return null;
} }
public NetworkInfo getNetworkInfo(int networkType) { public NetworkInfo getNetworkInfo(int networkType) {
@@ -586,18 +572,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
* none is active * none is active
*/ */
public LinkProperties getActiveLinkProperties() { public LinkProperties getActiveLinkProperties() {
enforceAccessPermission(); return getLinkProperties(mActiveDefaultNetwork);
for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
if (mNetConfigs[type] == null || !mNetConfigs[type].isDefault()) {
continue;
}
NetworkStateTracker t = mNetTrackers[type];
NetworkInfo info = t.getNetworkInfo();
if (info.isConnected()) {
return t.getLinkProperties();
}
}
return null;
} }
public LinkProperties getLinkProperties(int networkType) { public LinkProperties getLinkProperties(int networkType) {